Sign in Join
Wiki copytemporary

Extended Pascal

Extended Pascal is the name given to the version of Pascal specified in International Organization for Standardization (ISO) standard 10206. It specifies an enhanced version of the Standard Pascal language that was specified in the ISO 7185 specification. The 214-page ISO 10206 document was published in May 1991 and not been revised since.

Support in Free Pascal for Extended Pascal is planned, and will be via compiler mode extendedPascal.

Enhancements to Standard Pascal

Reserved Words

In addition to all the reserved words of Standard Pascal the following (referred to as word-symbols in the ISO 10206 document) have been added to Extended Pascal:

Symbols

In addition to all the symbols of Standard Pascal the following have been added to Extended Pascal:

Free Pascal support for Extended Pascal

Free Pascal has traditionally only supported the Borland dialects of Pascal, but Extended Pascal support will be available via compiler mode extendedpascal. Bug 0032549 has been set up to track its progress. Below is a list of things that have been implemented (if only in unapplied patches) and things that are planned. The planned features are subject to change.

Already supported features

These features are already supported in Free Pascal 3.0 and some earlier versions.

Conformant arrays (not yet implemented)

This is the standard way to pass arrays of various sizes to routines.

Set improvements (not yet implemented)

In addition to the * and >< operators, ISO 10206 also has a Card function, for retrieving the number of elements in a set. In Free Pascal, sets will still be limited to 256 elements for the foreseeable future (see Future Plans).

Generalized ordinal functions (not yet implemeted)

Modules (not yet implemented)

Modules are the standard way for modular programs, covering the same domain as UCSD units. There are two types of modules: those written in a single file and those written in two files. For modules written in one file, Free Pascal will search for them as it does for units (modulename.{p,pp,pas}). Suggestion for those written in two files as this is not provided in the standard: the compiler will search for the implementation file normally and then search for modulename.imp.{p,pp,pas}. The interface is in modulename.int.{p,pp,pas}, unless otherwise specified by a {$INTERFACE} directive.

pascal
program PathTest;

import
  SysUtils qualified only (GetEnvironmentVariable => GetEnv);

begin
  WriteLn(SysUtils.GetEnv('PATH'));
end.
pascal
type
  real_widget = record
    f1: integer;
    f2: real
  end;
  widget = restricted real_widget;

Two extensions from GNU Pascal are also planned:

Required interfaces

The modules StandardInput and StandardOutput are equivalent to input and output in a program's header.

Schemata (not yet implemented)

The standard defines a schema as a collection of similar types. Essentially, though, a schema is a data type that takes one or more arguments (called discriminants).

File routines

Date/Time

The GetTimeStamp procedure fills a TimeStamp record with details about the current time, which can be converted to a human-readable format via the Date and Time functions.

String functions

Complex Numbers

Number bases (not yet implemented)

It's possible to use any number base from 2 to 36.

Exponents

The ** operator for real exponents has existed in Free Pascal for a while, but the pow operator for integer exponents remains unimplemented.

New constants

Ensuring the proper order of Boolean expressions (not yet implemented)

ISO 10206 introduces the and_then and or_else operators when you need your expression to evaluated left to right. The and and or operators, on the other hand, can evaluate the Boolean expressions in any order. These new operators are especially useful for pointer operations, where you need to know whether a pointer is assigned before trying to dereference it.

The value keyword (not yet implemented)

The value keyword specifies the default value for a variable, type, parameter, or record field.

Note: Default parameters aren't defined in ISO 10206, but are in Appendix C.4 of the OOE draft.

Function result variables (not yet implemented)

Allows to bind a function's result to a variable, sort of like Delphi's Result.

Protected parameters (not yet implemented)

The protected keyword can also be used with parameters to indicated that they can't be changed in the routine, giving the compiler hints to aid optimization. To use the example given in the standard:

pascal
procedure illustrate(a: integer; var b: integer; protected c: integer; protected var d: integer);
begin
  a := 1; { value param }
  b := 1; { variable param }
{ c := 1; not legal }
{ d := 1; not legal }
end;

Type inquiry (not yet implemented)

Allows you to make the type of one variable or parameter the same as another variable or parameter.

Value constructors (not yet implemented)

This provides a cleaner alternative to Borland's typed constants (which aren't really constants at all) and gives a shortcut to constructing arrays and records at runtime.

Local variables with dynamic size (not yet implemented)

This should work but doesn't currently:

pascal
procedure p(n: integer);
var
  v: 1..n;
begin
  ...
end;

Acceptable Identifiers (not yet implemented)

External links


From the Free Pascal wiki, page "Extended Pascal", as it stood on 2024-02-28 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.