Comparison of Pascal and Delphi: Difference between revisions

Content deleted Content added
add some
Removed PROD: Delphi and Pascal are strongly related languages, so it is no WP:INDISCRIMINATE comparison. As for WP:OR issues: WP:TNT is not policy, while WP:ATD is.
 
(5 intermediate revisions by 4 users not shown)
Line 1:
{{Short description|Programming language}}
 
{{ProgLangCompare}}
{{use mdy dates|date=April 2023}}
Line 13 ⟶ 14:
 
=== Modulo with negative dividend ===
Standard Pascal has ana Euclidean-like definition of the [[Modulo#In programming languages|<syntaxhighlight lang="pascal" inline>mod</syntaxhighlight> operator]] whereas Delphi uses a truncated definition.
 
=== Nested comments ===
Standard Pascal requires that the comment delimiters <syntaxhighlight lang="pascal" inline>{</syntaxhighlight> and the bigramm <syntaxhighlight lang="pascal" inline>(*</syntaxhighlight>, as well as <syntaxhighlight lang="pascal" inline>}</syntaxhighlight> and <syntaxhighlight lang="pascal" inline>*)</syntaxhighlight> are synonymous to each other.<ref name="gpc_comments"/>
In Delphi, however, a block comment started by <syntaxhighlight lang="pascal" inline>{</syntaxhighlight> ''must'' be closed with a <syntaxhighlight lang="pascal" inline>}</syntaxhighlight>.<ref name="moore"/>
The bigramm <syntaxhighlight lang="pascal" inline>*)</syntaxhighlight> will only close any comment that started with <syntaxhighlight lang="pascal" inline>(*</syntaxhighlight>.<ref name="moore"/>
Line 28 ⟶ 29:
|-
! Standard Pascal !! Delphi
|- style="vertical-align:bottom"
|-
| <syntaxhighlight lang="pascal" highlight="3,4" style="font-size:85%">
program proceduralDataType(output);
 
{ `printYIntersect` has one procedural parameter: }
procedure printYIntersect(function f(x: real): real);
Line 43 ⟶ 46:
begin
printYIntersect(f);
end.
</syntaxhighlight>
| <syntaxhighlight lang="delphi" highlight="1-4" style="font-size:85%">
type
TFunc = function(x: real): real;
 
Line 59 ⟶ 64:
begin
printYIntersect(@f);
end.
</syntaxhighlight>
|}
 
Line 136 ⟶ 142:
=== Temporary files ===
In Delphi any file must be backed by a file in the file system.
That means any <syntaxhighlight lang="delphi" inline>file</syntaxhighlight> needs to be associated with a file name with Delphi’sDelphi's <syntaxhighlight lang="delphi" inline>assign</syntaxhighlight> procedure.
In contrast, Standard Pascal is usable without file names.
The following will produce a run-time error with Delphi.<ref name="moore"/>
Line 203 ⟶ 209:
== References ==
<references>
<ref name="gpc_comments">{{cite web
| title = The GNU Pascal Manual
| first1 = Jan-Jaap
| last1 = van der Heijden
| first2 = Peter
| last2 = Gerwinski
| first3 = Frank
| last3 = Heckenbach
| first4 = Berend
| last4 = deBoer
| first5 = Dominik
| last5 = Freche
| first6 = Eike
| last6 = Lange
| first7 = Peter
| last7 = Lewis
| display-authors = etal
| at = A QuickStart Guide from Borland Pascal to GNU Pascal
| url = https://www.GNU-Pascal.de/gpc/Comments.html#Comments
| access-date = 2023-04-24
}}</ref>
<ref name="reagan">{{cite web
| title = Pascal Standards FAQ
Line 209 ⟶ 236:
| last = Reagan
| date = 1995-04-03
| url = http://pascalPascal-centralCentral.com/extpascal.html#anchor-6
| archive-url = https://web.archive.org/web/20210928162340/http://pascal-central.com/extpascal.html#anchor-6
| archive-date = 2021-09-28
Line 219 ⟶ 246:
| last = Moore
| date = 2022-12-02
| url = https://www.moorecadMooreCAD.com/standardpascal/pascalfaq.html#Q.%20What%20are%20the%20differences%20between%20Borland%20Del
| access-date = 2023-04-24
}}</ref>
Line 226 ⟶ 253:
== Further reading ==
* Kathleen Jansen and [[Niklaus Wirth]]: ''PASCAL - User Manual and Report.'' Springer-Verlag, 1974, 1985, 1991, {{ISBN|0-387-97649-3}}, {{ISBN|0-387-90144-2}}, and {{ISBN|3-540-90144-2}} [https://web.archive.org/web/20050314152247/http://www.cs.inf.ethz.ch/~wirth/books/Pascal/]
* Niklaus Wirth: ''The Programming Language Pascal.'' Acta Informatica, 1, (Jun 1971) 35-6335–63
* ISO/IEC 7185: ''Programming Languages - PASCAL.'' [http://www.moorecad.com/standardpascal/]
* Doug Cooper: ''Standard Pascal: User Reference Manual.'' W. W. Norton & Company, 1983, {{ISBN|0-393-30121-4}}, {{ISBN|978-0-393-30121-2}}
Line 235 ⟶ 262:
 
{{Pascal programming language family}}
 
{{DEFAULTSORT:Pascal and Delphi comparison}}
[[Category:Pascal programming language family]]