Oz (programming language): Difference between revisions

Content deleted Content added
m clean up, replaced: ACM Computing Surveys (CSUR) → ACM Computing Surveys using AWB
Line 4:
|paradigm = [[multi-paradigm programming language|multi-paradigm]]: [[logic programming|logic]], [[functional programming|functional]], [[imperative programming|imperative]], [[object-oriented programming|object-oriented]], [[constraint programming|constraint]], [[distributed programming|distributed]], [[concurrent programming language|concurrent]]
|year = 1991
|designer = [[Gert Smolka]], his students
|developer = [[Mozart Consortium]]
|released = {{Start date and age|1991}}
|latest release version = 1.4.0
|latest release dateversion = Oz 1.4.0 =(final), {{startMozart date and age|df=yes|2008|07|03}}2
|latest release date = {{Start date and age|2008|07|03|df=yes}}
|typing = [[dynamic typing|dynamic]]
|implementations = Mozart Programming System
|license = [[MIT X11 License|MIT X11]] <ref>{{cite web | url=http://mozart.github.io/license-info/ | title=Mozart Oz License Info | date=2014-01-16 | accessdate=2014-01-16}}</ref>
|dialects = Oz, Mozart
|influenced by = [[Erlang (programming language)|Erlang]], [[Lisp (programming language)|Lisp]], [[Prolog]]
|influenced = [[Alice (programming language)|Alice]], [[Scala (programming language)|Scala]]
|website = [http://{{URL|mozart.github.io/ http://mozart.github.io]}}
}}
{{Use dmy dates|date=May 2012}}
Line 20 ⟶ 21:
'''Oz''' is a [[multiparadigm programming language]], developed in the Programming Systems Lab at [[Université catholique de Louvain]], for programming language education. It has a canonical textbook: [[Concepts, Techniques, and Models of Computer Programming]].
 
Oz was first designed by Gert Smolka and his students in 1991. In 1996 the, development of Oz continued in cooperation with the research group of Seif Haridi and Peter Van Roy at the [[Swedish Institute of Computer Science]]. Since 1999, Oz has been continually developed by an international group, the Mozart Consortium, which originally consisted of [[Saarland University]], the [[Swedish Institute of Computer Science]], and the [[Université catholique de Louvain]]. 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 by the Mozart Consortium. Mozart has been ported to different flavors of [[Unix]], [[FreeBSD]], [[Linux]], [[Microsoft Windows|Windows]], and [[Mac OS X]].
 
==Language features==
Oz<ref name="Oz programming model">
{{cite journal
| author = [[Gert Smolka]]
| title = The Oz Programming Model
|journal = Lecture Notes in Computer Science
Line 34 ⟶ 35:
| pages = 324–343
| url= https://www.ps.uni-saarland.de/Publications/documents/Vol1000.pdf}}
</ref> contains most of the concepts of the major [[programming paradigm]]s, including logic, functional (both [[lazy evaluation|lazy]] and [[eager evaluation|eager]]), imperative, object-oriented, constraint, distributed, and concurrent programming. Oz has both a simple formal semantics (see chapter 13 of the book mentioned below) and an efficient implementation.{{Citation needed|date=June 2007}}. Oz is a [[concurrencyConcurrency (computer science)|concurrency]]-oriented language, as the term was introduced by [[Joe Armstrong (programmer)|Joe Armstrong]], the main designer of the [[Erlang (programming language)|Erlang language]]. A concurrency-oriented language makes concurrency both easy to use and efficient. Oz supports a canonical [[graphical user interface]] (GUI) language QTk.<ref>[http://www.mozart-oz.org/home/doc/mozart-stdlib/wp/qtk/html/ QTk].</ref>
 
In addition to multi-paradigm programming, the major strengths of Oz are in [[constraint programming]] and [[distributed programming]]. 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, [[faultFault toleranttolerance|fault-tolerant]] applications within the language. For constraint programming, Oz introduces the idea of "''computation spaces";'', thesewhich allow user-defined search and distribution strategies [[Orthogonal#Computer science|orthogonal]] to the constraint ___domain.
 
==Language overview==
Line 54 ⟶ 55:
[2 4 6 8] % even more syntactic sugar
</source>
Those data structures are values (constant), [[first-class object|first class]] and [[dynamic typing|dynamically type checked]]. Variable names in ozOz start with an uppercase letter to distinguish them from [[Literal (computer programming)|literals]]<ref>https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/node3.html#label18</ref> which always begin with lowercase letter.
 
===Functions===
Line 125 ⟶ 126:
end
</source>
But Oz also provides a facility in case wea don'tfunction want the functionmust tonot return values. Such functions are called procedures.<ref>https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/node5.html#control.procedure</ref> Procedures are defined using the construct "proc" as follows
<source lang="erlang">
declare
Line 135 ⟶ 136:
 
===Dataflow variables and declarative concurrency ===
When the program encounters an unbound variable it waits for a value. For example, in the followingbelow, the thread will wait until both X and Y are bound to a value before showing the value of Z.
<source lang="erlang">
thread
Line 145 ⟶ 146:
</source>
 
It is not possible to change theThe value of a dataflow variable cannot be changed once it is bound:
<source lang="erlang">
X = 1
Line 174 ⟶ 175:
</source>
 
Because of the way dataflow variables work, it is possible to put threads anywhere in thea program and it is guaranteed that it will have the same result. This makes concurrent programming very easy. Threads are very cheap: it is possible to have a hundred thousand100,000 threads running at once.<ref>http://www.mozart-oz.org/documentation/tutorial/node8.html#chapter.concurrency</ref>
 
===Example: Trial division sieve===
This example computes a stream of prime numbers using the [[Trialtrial division]] algorithm by recursively creating concurrent stream agents that filter out non-prime numbers:
<source lang="erlang">
fun {Sieve Xs}
Line 197 ⟶ 198:
| number = 3
| pages = 359–411 }}
</ref> is possible. In the followingBelow, the fact is only computed when value of X is needed to compute the value of Y.
<source lang="erlang">
fun lazy {Fact N}
Line 208 ⟶ 209:
</source>
 
[[lazy evaluation]] gives the possibility of storing truly infinite data structures in Oz. The power of [[lazy evaluation]] can be seen from the following fragmentcode of codesample:
<source lang="erlang">
declare
Line 244 ⟶ 245:
 
=== Message passing concurrency ===
The declarative concurrent model can be extended with message passing throughvia simple semantics:
<source lang="erlang">
declare
Line 256 ⟶ 257:
</source>
 
With a port and a thread, theasynchronous programmeragents can definebe asynchronous agentsdefined:
<source lang="erlang">
fun {NewAgent Init Fun}
Line 267 ⟶ 268:
=== State and objects ===
 
It is again possible to extend the declarative model to support state and object-oriented programming with very simple semantics;. weTo create a new mutable data structure called Cells:
<source lang="erlang">
local A X in
Line 276 ⟶ 277:
</source>
 
With these simple semantic changes we can support, the whole object-oriented paradigm can be supported. With a little syntactic sugar, OOP becomes well integrated in Oz.
With a little syntactic sugar OOP becomes well integrated in Oz.
<source lang="erlang">
class Counter
Line 300:
 
==Execution speed==
The execution speed of a program produced by the Mozart Compilercompiler (version 1.4.0 implementing Oz 3) is very slow. On a set of benchmarks it is ''on average''averages about 50 times slower than that of the gcc[[GNU compilerCompiler Collection]] (GCC) for the C language, solving the benchmarks-tasks.<ref>[http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php?calc=chart&gcc=on&oz=on The Computer Language Benchmarks Game]</ref>{{failed verification|date=February 2014}}
 
==See also==
* [[Alice (programming language)|Alice]], thea concurrent functional constraint programming language from Saarland University
* [[Dataflow programming]]
* [[:Category:Functional logic programming languages|Functional logic programming languages]]
** [[Curry (programming language)|Curry]], a functional logic programming language
** [[Mercury (programming language)|Mercury]], a functional logic programming language
** [[Visual Prolog]], an object-oriented, functional, logic programming language
 
==References==
Line 316:
 
==External links==
* {{officialOfficial website|http://mozart.github.io/}}
* [http://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/index.html Tutorial of Oz]
* [http://www.info.ucl.ac.be/people/PVR/distribution.html Programming Language Research at UCL]: One of the core developers of Mozart/Oz, this group does research using Mozart/Oz as the vehicle
Line 323:
* [http://strasheela.sourceforge.net/strasheela/doc/01-Basics.html Oz Basics]
 
{{DEFAULTSORT:Oz (Programmingprogramming Languagelanguage)}}
[[Category:Multi-paradigm programming languages]]
[[Category:Functional logic programming languages]]