13.2 Syntax Improvements

Mozart implements the language Oz 3, as opposed to DFKI Oz 2, which implemented Oz 2. This chapter summarizes language changes between Oz 2 and Oz 3, of which most are only of syntactical nature.

13.2.1 Conditionals

The case keyword used to introduce one of two conditionals: the boolean or the pattern matching conditional. To adapt to common intuitions, the syntax and semantics have been changed.

Boolean Conditionals

The boolean conditional is now written as

if E then SE1 else SE2 end

If the construct is statement position, the else SE2 part is optional and defaults to else skip.

Since the if keyword is now used for boolean conditionals, the former (and seldom used) if conditional has been renamed to cond. There is no elsecond to replace elseif.

Pattern-Matching

The case E of ... end conditional retains its syntax but changes its semantics. Where formerly logic (dis-)entailment was used to match the value against a pattern, now a series of sequential tests is performed. This makes no difference if the match is entailed. Disentailment, however, may remain undiscovered and the thread block, e. g., in:

case f(a b) of f(X X) then ... end

Furthermore, the box [] separating pattern-matching clauses now also has sequential semantics, and is thus equivalent to the now deprecated, though still allowed, elseof.

elseif and elsecase may still be freely intermixed within if and case conditionals.

13.2.2 Functors

To accomodate modular application development, a module system has been designed. The language itself supports the definition of functors, from which modules can be obtained via linking.

13.2.3 Exceptions

The construct raise E1 with E2 end has been removed. This was an experimental feature that has been found to be rarely used.

13.2.4 Keywords

New Keywords

Due to syntax changes, Oz 3 has the following keywords, which thus cannot be used as unquoted atoms any more:

at

cond

define

export

functor

import

prepare

require

Removed Keywords

The following keywords have been returned atom status and do not count as keywords any more:

with

13.2.5 Core Expansion

The core expansion of Oz 3 as defined in ``The Oz Notation'' does not give core variables (written without backquotes) normal variable status any more, but considers them variables statically bound within a runtime library environment. This means that the used backquote variables are not part of the Base Environment.

This was necessary because the old design compromised language security.


Version 1.4.0 (20080702)