HOME

TheInfoList



OR:

Oz is a multiparadigm programming language, developed in the Programming Systems Lab at
Université catholique de Louvain UCLouvain (or Université catholique de Louvain , French for Catholic University of Louvain, officially in English the University of Louvain) is Belgium's largest French-speaking university and one of the oldest in Europe (originally establishe ...
, for programming-language education. It has a canonical textbook:
Concepts, Techniques, and Models of Computer Programming ''Concepts, Techniques, and Models of Computer Programming'' is a textbook published in 2004 about general computer programming concepts from MIT Press written by Université catholique de Louvain UCLouvain (or Université catholique de Louv ...
. Oz was first designed by Gert Smolka and his students in 1991. In 1996, development of Oz continued in cooperation with the research group of Seif Haridi and Peter Van Roy at the
Swedish Institute of Computer Science RISE SICS (previously Swedish Institute of Computer Science) is a leading research institute for applied information and communication technology in Sweden, founded in 1985. It explores the digitalization of products, services and businesses. In ...
. Since 1999, Oz has been continually developed by an international group, the Mozart Consortium, which originally consisted of
Saarland University Saarland University (, ) is a public research university located in Saarbrücken, the capital of the German state of Saarland. It was founded in 1948 in Homburg in co-operation with France and is organized in six faculties that cover all major ...
, the
Swedish Institute of Computer Science RISE SICS (previously Swedish Institute of Computer Science) is a leading research institute for applied information and communication technology in Sweden, founded in 1985. It explores the digitalization of products, services and businesses. In ...
, and the
Université catholique de Louvain UCLouvain (or Université catholique de Louvain , French for Catholic University of Louvain, officially in English the University of Louvain) is Belgium's largest French-speaking university and one of the oldest in Europe (originally establishe ...
. In 2005, the responsibility for managing Mozart development was transferred to a core group, the Mozart Board, with the express purpose of opening Mozart development to a larger community. The Mozart Programming System is the primary implementation of Oz. It is released with an
open source license Open-source licenses are software licenses that allow content to be used, modified, and shared. They facilitate free and open-source software (FOSS) development. Intellectual property (IP) laws restrict the modification and sharing of creative ...
by the Mozart Consortium. Mozart has been ported to
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
,
FreeBSD FreeBSD is a free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD). The first version was released in 1993 developed from 386BSD, one of the first fully functional and free Unix clones on affordable ...
,
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, and
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
.


Language features

Oz contains most of the concepts of the major
programming paradigm A programming paradigm is a relatively high-level way to conceptualize and structure the implementation of a computer program. A programming language can be classified as supporting one or more paradigms. Paradigms are separated along and descri ...
s, including logic, functional (both
lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an Expression (computer science), expression until its value is needed (non-strict evaluation) and which avoids repeated eva ...
and
eager evaluation In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the ...
), imperative, object-oriented, constraint, distributed, and concurrent programming. Oz has both a simple formal semantics (see chapter 13 of the book mentioned below) and Oz is a concurrency-oriented language, as the term was introduced by Joe Armstrong, the main designer of the Erlang language. A concurrency-oriented language makes concurrency easy to use and efficient. Oz supports a canonical
graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(GUI) language QTk. In addition to multi-paradigm programming, the major strengths of Oz are in
constraint programming Constraint programming (CP) is a paradigm for solving combinatorial problems that draws on a wide range of techniques from artificial intelligence, computer science, and operations research. In constraint programming, users declaratively state t ...
and
distributed programming Distributed computing is a field of computer science that studies distributed systems, defined as computer systems whose inter-communicating components are located on different networked computers. The components of a distributed system commu ...
. Due to its factored design, Oz is able to successfully implement a network-transparent distributed programming model. This model makes it easy to program open, fault-tolerant applications within the language. For constraint programming, Oz introduces the idea of ''computation spaces'', which allow user-defined search and distribution strategies
orthogonal In mathematics, orthogonality (mathematics), orthogonality is the generalization of the geometric notion of ''perpendicularity''. Although many authors use the two terms ''perpendicular'' and ''orthogonal'' interchangeably, the term ''perpendic ...
to the constraint domain.


Language overview


Data structures

Oz is based on a core language with very few datatypes that can be extended into more practical ones through
syntactic sugar In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely, or in an ...
. Basic data structures: * Numbers: floating point or integer (real integer) * Records: for grouping data : circle(x:0 y:1 radius:3 color:blue style:dots). Here the terms x,y, radius etc. are called features and the data associated with the features (in this case 0,1,3 etc.) are the values. * Tuples: Records with integer features in ascending order: circle(1:0 2:1 3:3 4:blue 5:dots) . * Lists: a simple linear structure ', '(2 ', '(4 ', '(6 ', '(8 nil)))) % as a record. 2, (4, (6, (8, nil))) % with some syntactic sugar 2, 4, 6, 8, nil % more syntactic sugar 4 6 8% even more syntactic sugar Those data structures are values (constant), first class and dynamically type checked. Variable names in Oz start with an uppercase letter to distinguish them from literals which always begin with a lowercase letter.


Functions

Functions are first class values, allowing higher order functional programming: fun if N =< 0 then 1 else N* end end fun div ( * ) % integers can't overflow in Oz (unless no memory is left) end fun case List of nil then 0 [] H, T then H+ % pattern matching on lists end end Functions may be used with both free and bound variables. Free variable values are found using static Scope (computer science), lexical scoping.


Higher-order programming

Functions are like other Oz objects. A function can be passed as an attribute to other functions or can be returned in a function. fun % A general function N*N end fun % F is a function here - higher order programming case Xs of nil then nil [] X, Xr then , end end %usage %browses [1 4 9]


Anonymous functions

Like many other functional languages, Oz supports use of anonymous functions (i.e. functions which do not have a name) with higher order programming. The symbol $ is used to denote these. In the following, the square function is defined anonymously and passed, causing 4 9/code> to be browsed. Since anonymous functions don't have names, it is not possible to define recursive anonymous functions.


Procedures

Functions in Oz are supposed to return a value at the last statement encountered in the body of the function during its execution. In the example below, the function Ret returns 5 if X > 0 and -5 otherwise. declare fun if X > 0 then 5 else ~5 end end But Oz also provides a facility in case a function must not return values. Such functions are called procedures. Procedures are defined using the construct "proc" as follows declare proc if X > 0 then else end end The above example doesn't return any value, it just prints 5 or -5 in the Oz browser depending on the sign of X.


Dataflow variables and declarative concurrency

When the program encounters an unbound variable it waits for a value. For example, below, the thread will wait until both X and Y are bound to a value before showing the value of Z. thread Z = X+Y end thread X = 40 end thread Y = 2 end The value of a dataflow variable cannot be changed once it is bound: X = 1 X = 2 % error Dataflow variables make it easy to create concurrent stream agents: fun if N

Max then nil else N, end end fun case Stream of nil then S [] H, T then S, end end local X Y in thread X = end thread Y = end end
Because of the way dataflow variables work, it is possible to put threads anywhere in a program and guaranteed that it will have the same result. This makes concurrent programming very easy. Threads are very cheap: it is possible to have 100,000 threads running at once.


Example: Trial division sieve

This example computes a stream of prime numbers using the trial division algorithm by recursively creating concurrent stream agents that filter out non-prime numbers: fun case Xs of nil then nil [] X, Xr then Ys in thread Ys = end X, end end


Laziness

Oz uses
eager evaluation In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the ...
by default, but
lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an Expression (computer science), expression until its value is needed (non-strict evaluation) and which avoids repeated eva ...
is possible. Below, the fact is only computed when value of X is needed to compute the value of Y. fun lazy if N =< 0 then 1 else N* end end local X Y in X = Y = X + 1 end
Lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an Expression (computer science), expression until its value is needed (non-strict evaluation) and which avoids repeated eva ...
gives the possibility of storing truly infinite data structures in Oz. The power of lazy evaluation can be seen from the following code sample: declare fun lazy case Xs#Ys of (X, Xr)#(Y, Yr) then if X < Y then X, elseif X>Y then Y, else X, end end end fun lazy case Xs of nil then nil [] X, Xr then N*X, end end declare H H = 1 , The code above elegantly computes all the Regular Numbers in an infinite list. The actual numbers are computed only when they are needed.


Message passing concurrency

The declarative concurrent model can be extended with
message passing In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
via simple semantics: declare local Stream Port in Port = % Stream is now 1, _ ('_' indicates an unbound and unnamed variable) % Stream is now 1, 2, _ ... % Stream is now 1, 2, .. , n, _ end With a port and a thread, asynchronous agents can be defined: fun Msg Out in thread end end


State and objects

It is again possible to extend the declarative model to support state and object-oriented programming with very simple semantics. To create a new mutable data structure called Cells: local A X in A = A := 1 % changes the value of A to 1 X = @A % @ is used to access the value of A end With these simple semantic changes, the whole object-oriented paradigm can be supported. With a little syntactic sugar, OOP becomes well integrated in Oz. class Counter attr val meth init(Value) val:=Value end meth browse end meth inc(Value) val :=@val+Value end end local C in C = end


Execution speed

The execution speed of a program produced by the Mozart compiler (version 1.4.0 implementing Oz 3) is very slow. On a 2012 set of benchmarks it averaged about 50 times slower than that of the
GNU Compiler Collection The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
(GCC) for the C language.The Computer Language Benchmarks Game
/ref>


See also

*
Alice (programming language) Alice ML is a general-purpose, high-level, multi-paradigm, functional programming language designed by the Programming Systems Laboratory at Saarland University, Saarbrücken, Germany. It is a dialect of Standard ML, augmented with support ...
, a concurrent functional constraint language from Saarland University *
Dataflow programming In computer programming, dataflow programming is a programming paradigm that models a program as a directed graph of the data flowing between operations, thus implementing dataflow principles and architecture. Dataflow programming languages share ...
*
Functional logic programming languages Functional may refer to: * Movements in architecture: ** Functionalism (architecture) ** Form follows function * Functional group, combination of atoms within molecules * Medical conditions without currently visible organic basis: ** Functional s ...
**
Curry (programming language) Curry is a declarative programming language, an implementation of the functional logic programming paradigm, and based on the Haskell language. It merges elements of functional and logic programming, including constraint programming integratio ...
**
Mercury (programming language) Mercury is a functional logic programming language made for real-world uses. The first version was developed at the University of Melbourne, Computer Science department, by Fergus Henderson, Thomas Conway, and Zoltan Somogyi, under Somogyi's ...
**
Visual Prolog Visual Prolog, previously known as PDC Prolog and Turbo Prolog, is a strongly typed object-oriented extension of Prolog. It was marketed by Borland as Turbo Prolog (version 1.0 in 1986 and version 2.0 in 1988). It is now developed and marketed by ...
, an object-oriented, functional, logic language


References

* Peter Van Roy and Seif Haridi (2004). ''
Concepts, Techniques, and Models of Computer Programming ''Concepts, Techniques, and Models of Computer Programming'' is a textbook published in 2004 about general computer programming concepts from MIT Press written by Université catholique de Louvain UCLouvain (or Université catholique de Louv ...
''. MIT Press. There i
online supporting material
for this book. The book, an introduction to the principles of programming languages, uses Oz as its preferred idiom for examples.


External links

*



One of the core developers of Mozart/Oz, this group does research using Mozart/Oz as the vehicle

Conference which gives a snapshot of the work being done with Mozart/Oz
Programming in Oz


{{DEFAULTSORT:Oz (programming language) Multi-paradigm programming languages Functional logic programming languages Logic programming languages Dynamically typed programming languages Prototype-based programming languages Concurrent programming languages Educational programming languages Programming languages created in 1991