Jump to content

PascalABC.NET

From Wikipedia, the free encyclopedia

PascalABC.NET
ParadigmMulti-paradigm:procedural,functional,object-oriented,generic
Designed byPascalABC.NET Compiler Team
First appeared2007;17 years ago(2007)
Stable release
3.8.3.3255 / 4 April 2023;14 months ago(2023-04-04)
Typing disciplineStatic,partially inferred
Implementation languagePascalABC.NET
OSCross-platform
LicenseLGPLv3
Filename extensions.pas
Websitepascalabc.net/en
Influenced by
Delphi,Pascal,Oxygene,C#,Python,Kotlin,Haskell

PascalABC.NETis ahigh-levelgeneral-purposeprogramming languagesupporting multiple paradigms. PascalABC.NET is based onDelphi'sObject Pascal,but also has influences fromC#,Python,Kotlin,andHaskell.It is distributed both as a command-line tool for Windows (.NETframework), Linux and MacOS (Mono), and with anintegrated development environmentfor Windows and Linux, including interactive debugger,IntelliSensesystem,form designer,code templates and code auto-formatting.

PascalABC.NET is implemented for the.NETframework platform, so that it is compatible with all.NET libraries and utilizes all the features ofCommon Language Runtime,such asgarbage collection,exception handling,andgenerics.Some language constructions, e.g. tuples, sequences, and lambdas, are based on regular.NET types. PascalABC.NET is ideologically close toOxygene,but unlike it, provides high compatibility withDelphi.

History of PascalABC.NET[edit]

PascalABC.NET was developed by a group of enthusiasts at the Institute of Mathematics, Mechanics, and Computer Science in Rostov-on-Don, Russia.[1]In 2003, a predecessor of the modern PascalABC.NET, called Pascal ABC, was implemented by associate professor Stanislav Mikhalkovich to be used for teaching schoolchildren instead ofTurbo Pascal,which became outdated and incompatible with modern operating systems but was still used for educational purposes. Pascal ABC was implemented as aninterpreted programming language,that led to a significant lack of performance. Four years after that it was completely rewritten by students Ivan Bondarev, Alexander Tkachuk, and Sergey Ivanov as acompiled programming languagefor the.NET platform. In 2009, PascalABC.NET started to be actively used for teaching high school students. By 2015, the number of users of the language had increased significantly. It began to be actively used throughout Russia in schools and at programming contests, surpassingFree Pascal.Since then, the PascalABC.NET developers have set themselves the goal of actively incorporating modern features into the language. In the same year, PascalABC.NET became an open source project distributed under theGNU Lesser General Public License(LGPLv3).[2][3]

In 2017[4]and 2022,[5]independent audit ofPascalABC.NET public repositorywas conducted. Based on the results of the static check, potentially dangerous code fragments were listed that require additional analysis by developers. It was also noted that the overall quality of the code could be improved. To do this, code duplication and redundant checks should be eliminated, and refactoring should be performed more carefully.

Use in school and higher education[edit]

Designed for education, PascalABC.NET remains the most common programming language in Russian schools and one of the recommended languages for passing theUnified State Examon informatics.[6][7][8]In the Southern Federal University, it is used as the first language for teaching students majoring in computer science, and for teaching children in one of the largest computer schools in Russia.[9]PascalABC.NET is widely used as a basic programming language in pedagogical universities for the training of computer science teachers.[10][11][12][13]It also serves as a tool for scientific computing.[14][15]PascalABC.NET is also built into a number of validation systems used for programming competitions.[16][17]

In 2020, during anti-COVID lockdowns and home schooling period, PascalABC.NET website was ranked 3rdin Yandex traffic rating in the "Programming" category, and the number of downloads of the installation kit exceeded 10000 a day.[18]

Though the core of the PascalABC.NET community is located in Russia, the language is also known in other countries such as Belarus,[19]Romania,[20]Indonesia,[21]Algeria.[22]

Language syntax[edit]

Differences between Delphi and PascalABC.NET[edit]

New features[edit]

loopstatement

loop10do
Write('*');

forloop with a step

forvari:=1to20step2do
Print(i);

foreachloop with an index

foreachvarcinArr('a'..'z')indexido
ifimod2=0then
Print(c);

a..branges

(1..10).Printlines

short function definition syntax

functionSum(a,b:real):=a+b;

method implementation can be placed inside a class definition

typePoint=class
x,y:real;
procedureOutput;
begin
Print(x,y);
end;
end;

sequence of Ttype as an abstraction of arrays, lists and sets

varseq:sequenceofinteger:=Arr(1..10);
seq.Println;
seq:=Lst(11..100);seq.Println;
seq:=HSet(1..20);seq.Println;

lambda functions

vara:=ArrGen(10,i->i*i);

auto classes - classes with an automatically generated constructor

typePoint=autoclass
x,y:real;
end;
varp:=newPoint(2,5);

one-dimensional and multi-dimensional array slices

varm:array[,]ofinteger:=MatrGen(3,4,(i,j)->i+j+1);
Println(m);// [[1,2,3,4],[2,3,4,5],[3,4,5,6]]
Println(m[:2,1:3]);// [[2,3],[3,4]]

Some other features such as inline variable declarations, type inference, andforstatement with a variable declaration are standard in the current version of Delphi. However, PascalABC.NET pioneered these features in 2007,[23]while in Delphi they were implemented in 2018.[24][25]

Changed features[edit]

  • strings incasestatements
  • sets based on arbitrary type:set of string
  • constructors can be invoked withnew T(...)syntax
  • type extension methods instead of class helpers
  • modules can be defined in a simplified form (withoutinterfaceandimplementationsections)

Not implemented features[edit]

Functional style features[edit]

In PascalABC.NET, functions arefirst-class objects.They can be assigned to variables, passed as parameters, and returned from other functions. Functional type is set in the formT -> Res.[26]Ananonymous functioncan be assigned to the variable of this type:

##// denotes that the main program will be written without enclosing begin-end
varf:real->real:=x->x*x;

Here is an example ofsuperpositionof two functions:

##
functionSuper<T,T1,T2>(f:T1->T2;g:T->T1):T->T2:=x->f(g(x));

varf:real->real:=x->x*x;
varfg:=Super(f,Sin);
vargf:=Super(Sin,f);

Print(fg(2));
Print(gf(2));

Superposition operation is defined in the standard library:

##
varf:real->real:=x->x*x;

Print((f*Cos)(2));
Print((Cos*f)(2));

In the book "How To Program Effectively In Delphi"[27]and in the corresponding video tutorials,[28][29]Dr. Kevin Bond, a programmer and a Computer Science teaching specialist,[30]notes that PascalABC.NET has powerful functional programming capabilities which are missing in Delphi. As an example,partial function applicationis demonstrated:

begin
varf:integer->integer->integer:=x->y->x+y;
Writeln(f(2)(6));
end.

Code examples[edit]

PascalABC.NET is a multi-paradigm programming language. It allows one to use different coding styles from oldschool Pascal to functional and object-oriented programming. The same task can be solved in different styles as follows:[31]

Usual PascalABC.NET style[edit]

begin
var(a,b):=ReadInteger2;// read input into tuple of two variables
varsum:=0;// type auto-inference
forvari:=atobdo
sum+=i*i;
Print($'Sum = {sum}')// string interpolation
end.

Procedural style[edit]

functionSumSquares(a,b:integer):integer;
begin
Result:=0;
forvari:=atobdo
Result+=i*i
end;

begin
var(a,b):=ReadInteger2;
Print($'Sum = {SumSquares(a,b)}')
end.

Functional style[edit]

This solution uses.NET extension methods for sequences and PascalABC.NET-specific range(a..b).

begin
var(a,b):=ReadInteger2;
(a..b).Sum(x->x*x).Print// method chaining with lambda expressions
end.

Object-oriented style[edit]

This solution demonstrates PascalABC.NET-specific short function definition style.

typeAlgorithms=class
staticfunctionSumSquares(a,b:integer):=(a..b).Sum(x->x*x);
staticfunctionSumCubes(a,b:integer):=(a..b).Sum(x->x*x*x);
end;

begin
var(a,b):=ReadInteger2;
Println($'Squares sum = {Algorithms.SumSquares(a,b)}');
Println($'Cubes sum = {Algorithms.SumCubes(a,b)}')
end.

Close to regular C# style[edit]

It is possible to write programs without usage of PascalABC.NET standard library. All standard.NET Framework classes and methods can be used directly.

usesSystem;// using.NET System namespace
begin
vararr:=Console.ReadLine.Split(
newchar[](' '),
StringSplitOptions.RemoveEmptyEntries
);
var(a,b):=(integer.Parse(arr[0]),integer.Parse(arr[1]));
varsum:=0;
forvari:=atobdo
sum+=i*i;
Console.WriteLine($'Sum = {sum}')
end.

Criticism[edit]

Though PascalABC.NET is actively used for teacher training,[7][10][32][33]some members of the teaching community ignore difference between historically used Turbo Pascal and PascalABC.NET, criticizing some unspecified "Pascal" language for being far from modern programming, too wordy and not simple enough to be used as the first programming language.[34][35]They consider Python to be the best starting point, as it is more concise and practically applicable. Their opponents, including PascalABC.NET developers themselves, argue that it is incorrect to put an equal sign between the classic Pascal and PascalABC.NET, as the latter contains lots of modern multi-paradigm features, including the ones from Python.[8][36][37]PascalABC.NET allows students to write as concise and expressive programs as Python,[38]and acts as a "bridge to production programming" by applying a static typing concept.[8]PascalABC.NET is also a compilable language, which makes it easier to learn programming, because all semantic errors are caught at compile time rather than occur unpredictably at runtime.[8][39]

References[edit]

  1. ^Osipov, Alexander V. (2019).PascalABC.NET: Vvedenie v sovremennoe programmirovanie [PascalABC.NET: Introduction to Modern Programming](in Russian). Rostov-on-Don, Russia. p. 28.{{cite book}}:CS1 maint: location missing publisher (link)
  2. ^"Twisted Pair Podcast, #389".Twisted Pair Podcast(in Russian). 30 March 2021.
  3. ^Bondarev, Ivan V.; Belyakova, Yulia V.; Mikhalkovich, Stanislav S. (24 April 2013)."PascalABC.NET programming system: 10 years of development"(PDF).PascalABC.NET.Retrieved9 April2023.
  4. ^"Analysis of PascalABC.NET using SonarQube plugins: SonarC# and PVS-Studio".PVS-Studio.29 March 2017.
  5. ^"Re-checking PascalABC.NET".Medium.11 February 2022.
  6. ^"Metodicheskie rekomendacii po podgotovke i provedeniyu edinogo gosudarstvennogo ekzamena po informatike i IKT v komp'yuternoj forme v gorode Moskve v 2021 godu [Guidelines for the preparation and conduct of the unified state exam in computer science and ICT in the city of Moscow in 2021]"(PDF)(in Russian). Departament obrazovaniya i nauki goroda Moskvy [Department of Education and Science of Moscow]. p. 110. Archived fromthe original(PDF)on 28 January 2022.Retrieved5 April2023.
  7. ^abPolyakov, Konstantin."Doklady na konferenciyah i seminarah [Reports at conferences and seminars]"(in Russian).
  8. ^abcdBogdanov, Alexey (4 October 2022)."PascalABC.Net or Python/ C#/C++".YouTube(in Russian).Retrieved5 April2023.
  9. ^Popova, Ekaterina (6 September 2022)."Kak v Rostove gumanitarii uspeshno obuchayutsya IT-special'nostyam [How humanitarians successfully study IT specialties in Rostov]".Komsomolskaya Pravda(in Russian).
  10. ^abDzhenzher, V.O.; Denisova, L.V. (2019)."Mathematical animation in computer simulation at school".Informatics in School(in Russian) (6): 51–54.doi:10.32517/2221-1993-2019-18-6-51-54.S2CID203704481.
  11. ^Dzhenzher, V.O.; Denisova, L.V. (2021)."Implementation of the Hamming code on PascalABC.NET while studying the theoretical foundations of informatics".Informatics in School(in Russian).1(9): 29–38.doi:10.32517/2221-1993-2021-20-9-27-36.S2CID245473319.
  12. ^Dzhenzher, V.O.; Denisova, L.V. (2020)."Scientific graphics in PascalABC.NET: plotting function graphs in a rectangular cartesian coordinate system".Informatics in School(in Russian) (1): 31–39.doi:10.32517/2221-1993-2020-19-1-31-39.S2CID215844807.
  13. ^Kulabukhov, S.Yu. (2021)."Mathematical modeling in informatiсs lessons using numerical solution of differential equations".Informatics in School(in Russian) (2): 14–21.doi:10.32517/2221-1993-2021-20-2-14-21.S2CID235541530.
  14. ^Khazieva, R.T.; Ivanov, M.D. (2020)."Selection of optimum device parameters for permanent magnetic field generation".Power Engineering: Research, Equipment, Technology(in Russian).22(6): 176–187.doi:10.30724/1998-9903-2020-22-6-176-187.S2CID233658494.
  15. ^Lukyanov, O.E.; Zolotov, D.V. (2021)."Methodological support for the training of UAV designers and operators".VESTNIK of Samara University. Aerospace and Mechanical Engineering(in Russian).20(1): 14–28.doi:10.18287/2541-7533-2021-20-1-14-28.S2CID236617894.
  16. ^"ACMP Olympiad System".Archivedfrom the original on 27 March 2023.Retrieved5 April2023.
  17. ^"Yandex Contest Compilers List".Yandex Contest.Archivedfrom the original on 14 March 2023.Retrieved5 April2023.
  18. ^Kubysheva, Olga (17 April 2020)."PascalABC.NET: Sajt sistemy programmirovaniya, razrabatyvaemoj na mekhmate YUFU, podnyalsya v rejtinge YAndeksa na tret'e mesto [PascalABC.NET: Site of programming system developed at SFedU MMCS faculty climbed up to the third place in Yandex ranking]".Komsomol'skaya pravda(in Russian).
  19. ^Kutysh, Aleksandr Z. (2018)."Razrabotka soderzhaniya vzaimosvyazannogo obucheniya budushchih uchitelej informatiki tekhnologiyam programmirovaniya [Development of interconnected training content for future computer science teachers in programming]"(PDF).Pedagogical Science and Education(in Russian) (3): 44–52.
  20. ^"Practică în Pascal".YouTube.21 January 2020.
  21. ^"Mengenal PascalABC.NET".Archivedfrom the original on 10 August 2022.Retrieved8 April2023.
  22. ^"PASCAL AND DELPHI TUTORIAL".YouTube.12 June 2022.
  23. ^"PascalABC.NET. What's New".PascalABC.NET(in Russian).Retrieved9 April2023.
  24. ^Embarcadero Technologies (21 November 2018)."See What's New in RAD Studio 10.3".YouTube.
  25. ^"Help for RAD Studio 10.3 Rio. What's New".Embarcadero. Product Documentation Wikis.Retrieved9 April2023.
  26. ^Osipov, Alexander V. (2019).PascalABC.NET: Vvedenie v sovremennoe programmirovanie [PascalABC.NET: Introduction to Modern Programming](in Russian). Rostov-on-Don, Russia. pp. 116–120.{{cite book}}:CS1 maint: location missing publisher (link)
  27. ^Kevin R. Bond (2021). "Chapter 44. Anonymous methods".How to Program Effectively in Delphi for AS/A Level Computer Science.Educational Computing Services Ltd.ISBN9780992753603.
  28. ^Kevin Bond."How to Program Effectively in Delphi. Lesson 44. Part 1".YouTube.Retrieved4 April2023.
  29. ^"Delphi Boot Camp 2022 - Delphi and functional programming using anonymous methods".YouTube.Retrieved4 April2023.
  30. ^"Brief biography Dr Kevin R Bond"(PDF).Educational Computing Services Ltd.
  31. ^"PascalABC.NET programming styles".Retrieved9 April2023.
  32. ^Dzhenzher, V.O.; Denisova, L.V. (2022)."Dynamic arrays and lists in PascalABC.NET".Informatics in School(in Russian) (1): 67–80.doi:10.32517/2221-1993-2022-21-1-67-80.S2CID249662060.
  33. ^"Nauchno-metodicheskaya konferenciya «Ispol'zovanie sistemy programmirovaniya PascalABC.NET v obuchenii programmirovaniyu» (29-30 marta 2023 g.) [Scientific and methodical conference" Using PascalABC.NET programming system in teaching programming "(March 29-30, 2023)]".Institute of Mathematics, Mechanics, and Computer Science(in Russian).Retrieved10 April2023.
  34. ^Panova, I.V.; Kolivnyk, A.A. (2020). "Methodological Aspects of Teaching Python Programming in the School Informatics Course".Informatics in School(in Russian) (6): 47–50.doi:10.32517/2221-1993-2020-19-6-47-50.S2CID225133880.
  35. ^"What's wrong with modern computer science teaching".Habr(in Russian). 28 May 2021.Retrieved8 April2023.
  36. ^Bragilevsky, Vitaly (14 April 2020)."The First Programming Language Dispute: The Final Solution".YouTube.JetBrains.
  37. ^Polyakov, Konstantin (24 August 2021)."New features in PascalABC.NET"(in Russian).
  38. ^Mikhalkovich, Stanislav (22 November 2021)."Comparing Python and PascalABC.NET".YouTube.
  39. ^Osipov, Alexander V. (2020).PascalABC.NET: vybor shkol'nika. CHast' 1. [PascalABC.NET: Schoolchildren's Choice. Part 1](in Russian) (2nd ed.). Southern Federal University. pp. 16–19.

External links[edit]