Skip to content

Revision Changes

Benjamin Kowarsch edited this page Jun 10, 2023 · 2 revisions

Changes to the Language Revision since 2021

Declaration and Definition Nomenclature

  • A declaration states that an entity exists.

  • A definition defines and institutes the entity.

To be consistent, proper nomenclature requires a change of the syntax for the module headers of so called 'definition' modules to either declaration or interface modules. Since their primary purpose is that of interface, they are renamed to interface modules and their module header syntax changed to

INTERFACE MODULE Ident;

Since this is perhaps the most intrusive change in the entire revision, our compiler implements DEFINITION as a synonym for INTERFACE to ease the transition for users of classical Modula-2.

The associated file type is .ifm but the continued use of .def is permissible.

For the benefit of clarity to human readers, it is recommended to use .def for interface modules that only contain constant, variable and type definitions and thus lack an implementation counterpart.

Removal of POINTER from OPAQUE Type Constructor

Use OPAQUE alone instead of OPAQUE POINTER.

TYPE Foo = OPAQUE; (* opaque pointer type *)

Restricted Use of OCTETSEQ to Formal Type only.

Legal:

PROCEDURE P ( arg : CAST OCTETSEQ );

Illegal:

VAR s : OCTETSEQ;
RECORD field : OCTETSEQ; ... END;

Change of Attributes in Binding Specifiers

Use of reserved words instead of single characters:

Old syntax:

PROCEDURE [NEW+] NewWithArgs ( ... );

New syntax:

PROCEDURE [NEW ARGLIST] NewWithArgs ( ... );

Old syntax:

PROCEDURE [NEW#] NewWithCapacity ( ... );

New syntax:

PROCEDURE [NEW CAPACITY] NewWithCapacity ( ... );

Old syntax:

PROCEDURE [READ*] ReadNew ( ... );

New syntax:

PROCEDURE [READ NEW] ReadNew ( ... );

However, the single character attribute # for formatted writing remains:

PROCEDURE [WRITE #] WriteF ( ... );

This maps 1:1 to the WRITE statement syntax

WRITE #("5;2", amount);

and its use in the binding is thus intuitive.

Removal of Syntax for Universal Set

use { TMIN(ValueType) .. TMAX(ValueType) } instead of {*}