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.
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.
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 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)}
.
A syntax for exception handling and raising is introduced (see Exceptions).
Due to sequential composition (see Sequential Composition), the semantics of
not ... end
is changed to
thread if ... then fail else
skip end
Parenthesis around statements are allowed (previously, only expressions could be grouped with parenthesis).
Apart from the usual decimal notation for integers (like
10
and ~999
), Oz provides the following
alternatives:
0
in front
of a list of octal digits. Example: 077
is equivalent
to 63
.
0x
in front
of a list of hexadecimal digits. Example: 0xff
is equivalent
to 255
.
0b
in front
of a list of binary digits. Example: 0b11111
is equivalent
to 31
.