All languages

Oz language

A multiparadigm language built on the concurrent constraint model: variables are single-assignment logic variables, threads are dataflow threads that suspend until their inputs are bound, and one kernel supports functional, object-oriented, constraint, and search programming. Implemented by the Mozart system.

Overview

Oz is a multiparadigm language built on the concurrent constraint model, where every variable is a single-assignment logic variable and every thread is a dataflow thread that suspends until the values it needs exist. It exists to unify paradigms that are usually kept separate rather than to invent a new one.

Code

% numbers, atoms, and the binding that gives a logic variable its value
local X Y Z in
   X = 5
   Y = 10
   if X >= Y then Z = X else Z = Y end
   {Browse Z}                          % 10
end

{Show 'Hello World'}                   % atoms are primitives too
Z = X is not an assignment but a binding: an unbound variable becomes equal to a value, and a conflicting value raises a failure exception rather than overwriting. Every other slot reuses that primitive — pattern matching destructures with it, a procedure reports through an output argument still unbound on entry, and the dataflow idiom is a consumer suspending on a variable the producer will bind.

Distinctive traits

  • Dataflow threads, not scheduler threads. A thread blocks automatically until its statement's inputs are bound, so stream producer and consumer need no explicit synchronisation primitive.
  • One kernel, many paradigms. The full language desugars to a kernel of bindings, cells, procedures, and threads, so classes, constraints, and search are libraries over shared semantics.
  • Constraint stores and computation spaces make search first-class. A space encapsulates a speculative computation, so a solver is an ordinary Oz program rather than a separate subsystem.
  • Classes are stateless descriptions with multiple inheritance. A class is a chunk holding a method table, so conflicts between parents resolve when the table is built, not at call time.
  • State is explicit and opt-in. Cells are mutable pointers created deliberately, so the declarative fragment defaults to single-assignment and stays concurrency-safe.
  • Dynamically typed, with structural equality. A binding determines a variable's type, and records compare by structure rather than by identity.

Status

Active as a language, but with a split implementation story: Mozart 1.x (through 1.4.0) implements Oz 3 including constraints and distribution, while Mozart 2 is a redesigned 64-bit VM whose first release omitted both, planning them for later releases.

History

Oz 1 developed a fine-grained concurrency model that proved hard to control and debug; Oz 2 replaced it with explicit thread creation, a new object system, and much stronger constraint and search support; Oz 3 added functors and futures while staying almost wholly upward compatible with Oz 2. The first public release of the Oz 1 implementation was in 1995. Mozart was developed by Smolka's group at DFKI, Haridi's at SICS, and Van Roy's at UCL.

Sources & references