(If I quote only a TP or a Delphi version as origin, it means that FPC also supports it out of compat to that version)
>> Constant expressions
const
<name> = <expr>; (* expr can contain, constants, other named constants and operators *)
(* likewise, constant-value expressions could be used in type declarations, and other places where simple constants were required *)
And under FPC some built-ins, e.g. ORD() I assume that is the same under classic Pascals. Turbo already had some of this, but over the years the number of options (read: built-ins) were expanded.
>> Variable initialization
var
<name> : <type> = <expr>. (* equivalent to an assignment at the start of the block *)
Delphi 4 has the syntax, but this makes it a scope protected global initialized symbol when nested in e.g. a procedural block.
FPC modes try to do this the C way, but I avoid the feature as the plague. Adding a "feature" using the same syntax for a semantically unrelated feature is not sane.
See note in
https://www.freepascal.org/docs-html/3.0.0/ref/refse23.html>> Loop-exit form:
loop. (* loop forever, until exit condition is true *)
….
exit if <expr>; (* multiple allowed *)
….
end;
Modula-2 has this but it would be simply if <expr> then exit; Continue and break somewhere in the later Turbo Pascals ?
>> Additional control constructs
let <name> = <expr> do <stmt>; (* assign the value to the variable, and execute the statement *)
(* the variable is known only within the scope of the statement *)
Nope. Doesn't even look familiar (except LET from Basic). But I don't have (any) Algol experience or knowledge
>> Condition boolean operations
orif / andif (* analogous to || and && *)
Simply "or" and "and". Differences between boolean and integer operators are generally not a problem in Pascal. I think this dripped in from somewhere else.
Some non Borland dialects might have or_else and_else for short circuit, Borland dialects use directives/pragmas for that.
>> Return statement
return <expr>; (* from a function *)
or
return; (* in a procedure *)
Modula-2. Pascal has Exit() since D2009, but Free Pascal has had it before (2000ish, FPC 1.0.x)
>> Set iteration
for <name> in <set expr> do <stmt> ; (* perform statement with name bound to values in the set *)
D2009 and FPC 3.0. Name must be of the enum type of the set.
>> Additional parameter passing modes
In a procedure or function declaration:
procedure xxx (<ptype> <name> : <type>; … )
<ptype> could be
var — by reference
<empty> — by value
in — by value
out — copy out on return
inout — by value on input and copy out on return
var, const, out . var and const since TP types, OUT since D4 or D6 mostly for ref counted interfaces as reason.
Some very recent Delphi and a slightly older FPC support either const [ref] or constref as modifier to forcedly pass by reference (instead of leaving that up to the ABI with possible inconsistent behaviour between architectures)
>> Module definition
module <name> ; (* at the beginning of a file defines a module *)
use <name> ; (* in another file, incorporates the definitions from another module *)
I believe that you had to use x.y in a referencing module. I don’t believe that it did an “import *”.
unit/uses but afaik standard pascal and modula use module and import (and Modula2 also QUALIFIED/UNQUALIFIED and FROM module_xx IMPORT yy;)
>> Improved type definition
I believe that you could do things like
type
<name> : 0..<expr> (* where expr was actually a variable expression, useful with parameters and fields, especially arrays *)
As long as it is compile time resolvable, it was allowed.
>> Parametric types
We were able to define a record that was partly self defining. Examples:
type
x = record
y: integer
z: array [0..y] of integer;
end
a = record
b: 0..4
case b of
0: (d, e, f:…);
1: (g, h, i: …);
These were intended to be used with pointers to records to describe variable operation system structures.
ISO Pascal feature. Some support in mode ISO. Like packed/unpacked arrays a mostly ignored feature in Borland Pascals
>> Explicit packing and allocation control
I vaguely recall that you could add “packed <bitsize>” to individual field definitions.
Bitpacking not supported in any standard, but a common extension in more embedded system. Free Pascal uses a bitpacked modifier for this, and also support bitpacked fields. Delphi doesn't have any support.
>> Exceptions
I forget how these worked.
Delphi, but of course various kinds of exceptions exist.