Oz, short for Oz Programming Language, is a multiparadigm programming language created by Gert Smolka and colleagues at the Programming Systems Lab, University of Passau, in 1991. It is primarily used for teaching concepts in programming languages, research on constraint programming, and multiparadigm application development. Developers can access Oz by downloading it from the official Mozart Programming System website at Mozart Downloads, which provides the interpreter, libraries, and documentation for Windows, macOS, and Linux.
Oz exists to unify multiple programming paradigms—functional, logic, object-oriented, and concurrent programming—into a single, coherent language. Its design philosophy emphasizes flexibility, declarative constructs, and constraint-based computation. By supporting multiple paradigms in one environment, Oz solves the problem of exploring and teaching complex programming concepts while allowing for expressive and concise implementation of diverse algorithms.
Oz: Variables and Bindings
Oz uses single-assignment variables that support both declarative and imperative programming styles.
declare X Y Z
X = 10
Y = 20
Z = X + Y
{Browse Z}Variables can be assigned once, and computation can be performed through expressions. The {Browse} function displays values interactively. This model is similar to declarative constructs in Prolog and functional bindings in Haskell.
Oz: Procedures and Functions
Oz supports first-class procedures and functions for modular and reusable code.
fun {Square N}
N*N
end
{Browse {Square 5}}Functions encapsulate logic, returning computed values. This functional approach parallels procedures in ML and functions in Haskell, promoting concise and reusable code structures.
Oz: Objects and Classes
Oz includes object-oriented features with classes, inheritance, and methods.
class Person
attr name age
meth introduce
{Browse name#age}
end
end
A = {New Person name: 'Alice' age: 30}
{A.introduce}Classes define templates for objects, and methods encapsulate behavior. This OOP paradigm is similar to Java and C++, supporting modular and reusable design.
Oz: Concurrency and Dataflow
Oz natively supports concurrent programming using threads and dataflow variables.
thread X = 5 end
thread Y = 10 end
thread Z = X + Y {Browse Z} endThreads execute concurrently, and dataflow variables synchronize automatically. This concurrency model is comparable to threads in C++ and asynchronous constructs in Python.
Oz: Constraint Programming
Oz offers integrated support for constraint programming, enabling declarative problem solving.
{FD.distribute [X Y Z] min}
X + Y = Z
X in 1..10
Y in 1..10
Z in 10..20
{Browse [X Y Z]}Constraints define relations over variables and domains. This allows solving combinatorial problems efficiently, similar to constraint handling in Prolog and finite domain solvers in Haskell.
Overall, Oz provides a multiparadigm, declarative, and concurrent programming environment. When used alongside Prolog, Haskell, and C++, it enables developers and researchers to explore advanced programming concepts, develop concurrent and constraint-based applications, and teach programming paradigms effectively. Its combination of functional, logic, object-oriented, and concurrent features makes Oz a versatile and enduring language for research and education.