PascalABC.NET
This article may have been previously nominated for deletion: Wikipedia:Articles for deletion/PascalABC.NET exists. It is proposed that this article be deleted because of the following concern:
If you can address this concern by improving, copyediting, sourcing, renaming, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it. This message has remained in place for seven days, so the article may be deleted without further notice. Find sources: "PascalABC.NET" – news · newspapers · books · scholar · JSTOR Nominator: Please consider notifying the author/project: {{subst:proposed deletion notify|PascalABC.NET|concern=No citations (with "more citations needed" template added in April 2016), does not seem to be notable (most hits on the first 5 pages of Google are auto-generated or self-created, only 10 [https://stackoverflow.com/search?q=pascalabc.net StackOverflow questions]), conflict of interest (article created and edited primarily by two of the software’s authors).}} ~~~~ Timestamp: 20230402125650 12:56, 2 April 2023 (UTC) Administrators: delete |
![]() | This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Paradigm | Multi-paradigm: procedural, functional, object-oriented, generic |
---|---|
Designed by | S.S. Mikhalkovich, Ivan Bondarev, A.V. Tkachuk, S.O. Ivanov |
First appeared | 2007 |
Stable release | 3.8.3.3167
/ 30 August 2022 |
Typing discipline | Static, partially inferred |
Implementation language | PascalABC.NET |
OS | Cross-platform |
License | LGPLv3 |
Filename extensions | .pas |
Website | pascalabc |
Influenced by | |
Delphi, Pascal, Oxygene, C#, Python, Kotlin, Haskell |
PascalABC.NET is a high-level general-purpose programming language supporting multiple paradigms. It is compatible with classic procedural Pascal, but provides extensive support of object-oriented and functional paradigms. It is distributed both as a command-line tool for Windows (native), Linux and MacOS (Mono), and with an integrated development environment for Windows, including interactive debugger, IntelliSense system, form designer, code templates and code auto-formatting.
PascalABC.NET is implemented for the .NET Framework platform, so that it is compatible with all .NET libraries and utilizes all the advantages of Common Language Runtime, such as garbage collection and generics.
Key features of PascalABC.NET
Pascal syntax extensions
- Operators
+= -= *= /=
- in-block variable definitions
- Variable declaration in
for
loop header - Variable declaration with initialization (
var n: integer := 10;
) - Variable type deduction (
var x := 1;
) foreach
- Routines with a variable number of parameters
set
of any type (set of integer
)- Methods in records
- Methods defined in class declaration
- Simplified syntax of units
- Keyword
new
(invoking a constructor) - Field initializers
- Static constructors
- OpenMP directives
- Case for strings
- Tuple type syntax (T1, T2)
- Yield and yield sequence
- Pattern matching
- Array slices
- Interpolated strings
Object-oriented features
- Classes and interfaces
- Operator overloading
- Exception handling
- Generic classes and routines
- Garbage collection
Functional style features
In PascalABC.NET, functions are first-class objects. They can be assigned to variables, passed as parameters, and returned from other functions. Functional type is set in the form T -> Res
. An anonymous function can be assigned to the variable of this type:
## // denotes that the main program will be written without enclosing begin-end
var f: real -> real := x -> x*x;
Here is an example of superposition of two functions:
##
function Super<T,T1,T2>(f: T1 -> T2; g: T -> T1): T -> T2 := x -> f(g(x));
var f: real -> real := x -> x*x;
var fg := Super(f,Sin);
var gf := Super(Sin,f);
Print(fg(2));
Print(gf(2));
Superposition operation is defined in the standard library:
##
var f: real -> real := x -> x*x;
Print((f*Cos)(2));
Print((Cos*f)(2));
In the book "How To Program Effectively In Delphi"[1] and in the corresponding video tutorials[2][3], Dr. Kevin Bond, a programmer and a Computer Science teaching specialist[4], notes that PascalABC.NET has powerful functional programming capabilities which are missing in Delphi. As an example, partial function application is demonstrated:
##
var f: real -> real -> real := x -> y -> x + y;
Print(f(2)(3));
Use in school and higher education
Designed for education, PascalABC.NET remains the most common programming language in Russian schools and one of the recommended languages for passing the Unified State Exam on informatics[5][6][7]. 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[8]. PascalABC.NET is widely used as a basic programming language in pedagogical universities for the training of computer science teachers[9][10][11][12]. It also serves as a tool for scientific computing[13][14].

PascalABC.NET has built-in units aimed at teaching children of primary and secondary school age: GraphWPF (raster graphics), WPFObjects (vector graphics), Graph3D (3D graphics and animation), Robot, Drawman and TurtleWPF (for beginners).These units represent a higher abstraction level allowing beginners not to focus on technical aspects of drawing.
The figure shown is drawn with the following code:
uses TurtleWPF;
begin
Down; // prepare turtle's pen
SetSpeed(11); // set turtle's movement speed
SetColor(Colors.Red); // set pen color
for var i:=1 to 450 do
begin
SetColor(RGB(128+i,0,i)); // change pen color
Forw(i); // move turtle forward
Turn(96); // rotate turtle clockwise
end;
end.
PascalABC.NET is also built into a number of validation systems used for programming competitions[15][16].
Programming styles and code examples
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:
Oldschool style
var a,b,i,sum: integer; // variables definition preceeds the main program body
begin
Read(a,b);
sum := 0;
for i:=a to b do
sum := sum + i*i;
Write('Sum = ',sum)
end.
Equivalent PascalABC.NET style
begin
var (a,b) := ReadInteger2; // read input into tuple of two variables
var sum := 0; // type auto-inference
for var i:=a to b do
sum += i*i;
Print($'Sum = {sum}') // string interpolation
end.
Procedural style
function SumSquares(a,b: integer): integer;
begin
Result := 0;
for var i := a to b do
Result += i * i
end;
begin
var (a,b) := ReadInteger2;
Print($'Sum = {SumSquares(a,b)}')
end.
Functional style
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
This solution demonstrates PascalABC.NET-specific short function definition style.
type Algorithms = class
static function SumSquares(a,b: integer) := (a..b).Sum(x -> x*x);
static function SumCubes(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
It is possible to write programs without usage of PascalABC.NET standard library. All standard .NET Framework classes and methods can be used directly.
uses System; // using .NET System namespace
begin
var arr := Console.ReadLine.Split(
new char[](' '),
StringSplitOptions.RemoveEmptyEntries
);
var (a,b) := (integer.Parse(arr[0]),integer.Parse(arr[1]));
var sum := 0;
for var i:=a to b do
sum += i*i;
Console.WriteLine($'Sum = {sum}')
end.
Code audit
In 2017[17] and 2022[18], independent audit of PascalABC.NET public repository was 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.
See also
References
- ^ Kevin R. Bond (2021). "Chapter 44. Anonymous methods". How to Program Effectively in Delphi for AS/A Level Computer Science. Educational Computing Services Ltd. ISBN 9780992753603.
- ^ Kevin Bond. "How to Program Effectively in Delphi. Lesson 44. Part 1". YouTube. Retrieved 4 April 2023.
- ^ "Delphi Boot Camp 2022 - Delphi and functional programming using anonymous methods". YouTube. Retrieved 4 April 2023.
- ^ "Brief biography Dr Kevin R Bond" (PDF). Educational Computing Services Ltd.
- ^ "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.
- ^ Polyakov, Konstantin. "Doklady na konferenciyah i seminarah [Reports at conferences and seminars]" (in Russian).
- ^ Bogdanov, Alexey (4 October 2022). "PascalABC.Net or Python/ C#/C++". YouTube (in Russian). Retrieved 5 April 2023.
- ^ 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).
- ^ Dzhenzher, 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.
- ^ 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) (9): 29–38. doi:10.32517/2221-1993-2021-20-9-27-36.
- ^ 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.
- ^ 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.
- ^ 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.
- ^ 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.
- ^ "ACMP Olympiad System". Archived from the original on 27 March 2023. Retrieved 5 April 2023.
- ^ "Yandex Contest Compilers List". Yandex Contest. Archived from the original on 14 March 2023. Retrieved 5 April 2023.
- ^ "Analysis of PascalABC.NET using SonarQube plugins: SonarC# and PVS-Studio". PVS-Studio. 29 March 2017.
- ^ "Re-checking PascalABC.NET". Medium. 11 February 2022.
External links