Syntax Improvements


General Remarks

The syntax of Oz underwent a general overhaul. Most changes are conservative. In the following, we briefly describe the most significant changes and the non-conservative changes. A full description of the Oz syntax is given in The Oz Notation.

Keywords

The keywords fi, ro, and RO are replaced by end.

The boolean truth values are now represented by the keywords true and false (previously True and False).

An additional keyword unit represents a name that is used by convention as unit value as in functional programming and as synchronization value in concurrent programs.

Objects

Classes can have properties as indicated by the syntax class C prop ... end. Meaningful properties are final, indicating that the class cannot be inherited, and locking, indicating that its instances can be locked (see Objects).

In methods of lockable objects, a code segment may be enclosed by lock ... end indicating that only one thread can enter this code segment on a given object at a time (see Objects).

Methods enjoy functional syntax as in meth a(X Y $) X + Y end similar to procedure definitions.

Method application now enjoys the syntax Class , Message as opposed to the previous syntax <<Class Message>>. Note that the first argument must be a class (previously, objects were allowed as well).

The special syntax for object creation with implicit class definition create O with e ... end is not longer supported by Oz. Instead, the class must be created explicitly as in O={New class $ ... end e}

Records

Records with features 1 through n are supported syntactically as in {Show x(foo bar a:4 baz b:5 7)} which is equivalent to {Show x(1:foo 2:bar a:4 3:baz b:5 4:7)}.

Exception Handling

A syntax for exception handling and raising is introduced (see Exceptions).

Negation

Due to sequential composition (see Sequential Composition), the semantics of not ... end is changed to thread if ... then fail else skip end

Parenthesis

Parenthesis around statements are allowed (previously, only expressions could be grouped with parenthesis).

Integers

Apart from the usual decimal notation for integers (like 10 and ~999), Oz provides the following alternatives:


Martin Henz