Devised by
Niklaus Wirth
Niklaus Emil Wirth (born 15 February 1934) is a Swiss computer scientist. He has designed several programming languages, including Pascal, and pioneered several classic topics in software engineering. In 1984, he won the Turing Award, generally ...
in the late 1960s and early 1970s,
Pascal is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
. Originally produced by
Borland Software Corporation,
Embarcadero Delphi
Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, ...
is composed of an IDE, set of standard libraries, and a Pascal-based language commonly called either
Object Pascal
Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.
The language was originally developed by Apple Computer as ''Clascal'' for the Lisa Worksh ...
, Delphi Pascal, or simply 'Delphi' (Embarcadero's current documentation refers to it as 'the Delphi language (Object Pascal)'
). Since first released, it has become the most popular commercial Pascal implementation.
While developing Pascal, Wirth employed a
bootstrapping
In general, bootstrapping usually refers to a self-starting process that is supposed to continue or grow without external input.
Etymology
Tall boots may have a tab, loop or handle at the top known as a bootstrap, allowing one to use fingers ...
procedure in which each newer version of the Pascal compiler was written and compiled with its predecessor. Thus, the 'P2' compiler was written in the dialect compilable by 'P1', 'P3' in turn was written in 'P2' and so on, all the way till 'P5'. The 'P5' compiler implemented Pascal in its final state as defined by Wirth, and subsequently became standardised as 'ISO 7185 Pascal'.
The Borland dialect, like the popular
UCSD Pascal
UCSD Pascal is a Pascal programming language system that runs on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1977. It was developed at the University of California, San Diego (U ...
before it, took the 'P4' version of the language as its basis, rather than Wirth's final revision. After much evolution independent of Standard Pascal, the Borland variant became the basis for Delphi. This page goes over the differences between Delphi and Standard Pascal. It does ''not'' go into Delphi-specific extensions to the language, which are numerous and still increasing.
Exclusive features
Following features are mutually exclusive.
The Standard Pascal implementation is not accepted by Delphi and vice versa, the Delphi code is not acceptable in Standard Pascal.
Modulo with negative dividend
Standard Pascal has an Euclidean-like definition of the
mod operator whereas Delphi uses a truncated definition.
Nested comments
Standard Pascal requires that the comment delimiters
and
*) are synonymous to each other.
In Delphi, however, a block comment started by
.
The bigramm
*) will only close any comment that started with
(*.
This scheme allows for ''nested'' comments at the expense of compiler complexity.
Procedural data types
The way procedures and functions can be passed as parameters differs:
Delphi requires explicit procedural types to be declared where Standard Pascal does not.
Conversion of newline characters
Various computer systems show a wide variety how to indicate a
newline.
This affects the internal representation of
text files which are composed of a series of “lines”.
In order to relieve the programmer from any associated headaches, Standard Pascal mandates that ''reading'' an “end-of-line character” returns a single space character.
To distinguish such an “end-of-line” space character from a space character that is actually genuine payload of the line,
EOLn becomes
true.
Delphi does not show this behavior.
Reading a newline will return whatever character sequence represents a newline on the current host system, for example two
char values
chr(13) (carriage return) plus
chr(10) (line feed).
Additional or missing features
Following features are present or missing in either language.
Global goto
Standard Pascal permits a
goto to any
label defined in scope.
In Delphi a
goto must be within the current routine, i. e. may not leave the
begin … end-frame.
program jumpAround;
label
999;
procedure foo;
begin
goto 999;
end;
begin
foo;
999: ;
end.
Buffer variables
Delphi does not support buffer variables and associated standard routines
get and
put.
program copy(input, output);
begin
while not EOF(input) do
begin
output↑ := input↑;
if EOLn(input) then
begin
writeLn(output);
end
else
begin
put(output);
end;
get(input);
end;
end.
Discriminated variant record allocation
In Standard Pascal allocating memory for a variant
record may indicate a specific variant.
This allows implementations to allocate the least amount of ''really'' necessary memory.
Delphi does not support this.
program variantRecord;
type
sex = (female, male);
clothingMeasures = record
girth: real;
case gender: sex of
female: (underbust: real);
male: ( );
end;
var
size: clothingMeasures;
begin
new(size, male);
end.
Temporary files
In Delphi any file must be backed by a file in the file system.
That means any
file needs to be associated with a file name with Delphi’s
assign procedure.
In contrast, Standard Pascal is usable without file names.
The following will produce a run-time error with Delphi.
program temporaryFile(output);
var
FD: text;
begin
rewrite(FD);
writeLn(FD, 'Hello world!');
end.
Packing
Delphi does not implement the standard procedures
pack and
unpack.
Regardless, transferring data between packed and unpacked data types is an easy feat, although the implementation might not be as efficient as a compiler vendor supplied implementation would be.
Missing default write width
Delphi does not associate the data type
Boolean with a default width if specified as
write/
writeLn parameters.
Delphi demonstrates the behavior as usual for character-strings.
Overloading
Delphi permits overloading routines.
In Standard Pascal identifiers must be unique in every block.
function f(x: integer): real;
begin
result := sin(x);
end;
function f(x: real): real;
begin
result := cos(x);
end;
// ─── MAIN ─────────────────────────────────────────────
begin
// Note the different data types.
writeLn(f(3));
writeLn(f(3.0));
end.
Default parameter values
Delphi permits
default parameter
In computer programming, a default argument is an argument to a function that a programmer is not required to specify.
In most programming languages, functions may take one or more arguments. Usually, each argument must be specified in full (this ...
s.
Peculiar implementation characteristics
Standard write width
In Pascal, if the destination file is a
text file, the parameters to
write/
writeLn have an implemention-defined default total width.
In Delphi, for
integer values this is simply
1.
That means always the least amount of space is occupied.
Other compilers have shown default widths of, for example,
20 allowing for a fine tabular look at no cost of extra code.
References
Further reading
* Kathleen Jansen and
Niklaus Wirth
Niklaus Emil Wirth (born 15 February 1934) is a Swiss computer scientist. He has designed several programming languages, including Pascal, and pioneered several classic topics in software engineering. In 1984, he won the Turing Award, generally ...
: ''PASCAL - User Manual and Report.'' Springer-Verlag, 1974, 1985, 1991, , , and
* Niklaus Wirth: ''The Programming Language Pascal.'' Acta Informatica, 1, (Jun 1971) 35-63
* ISO/IEC 7185: ''Programming Languages - PASCAL.'
* Doug Cooper: ''Standard Pascal: User Reference Manual.'' W. W. Norton & Company, 1983, ,
External links
The ISO 7185 Pascal web site
{{DEFAULTSORT:Pascal and Delphi comparison
Pascal programming language family
Borland
Comparison of individual programming languages