Alice ML
   HOME

TheInfoList



OR:

Alice ML is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
designed by the Programming Systems Laboratory at
Saarland University Saarland University (german: Universität des Saarlandes, ) 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 si ...
,
Saarbrücken Saarbrücken (; french: link=no, Sarrebruck ; Rhine Franconian: ''Saarbrigge'' ; lb, Saarbrécken ; lat, Saravipons, lit=The Bridge(s) across the Saar river) is the capital and largest city of the state of Saarland, Germany. Saarbrücken is S ...
,
Germany Germany,, officially the Federal Republic of Germany, is a country in Central Europe. It is the second most populous country in Europe after Russia, and the most populous member state of the European Union. Germany is situated betwe ...
. It is a
dialect The term dialect (from Latin , , from the Ancient Greek word , 'discourse', from , 'through' and , 'I speak') can refer to either of two distinctly different types of Linguistics, linguistic phenomena: One usage refers to a variety (linguisti ...
of
Standard ML Standard ML (SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. It is popular among compiler writers and programming language researchers, as well as in the development of the ...
, augmented with support for
lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (sharing). The b ...
,
concurrency Concurrent means happening at the same time. Concurrency, concurrent, or concurrence may refer to: Law * Concurrence, in jurisprudence, the need to prove both ''actus reus'' and ''mens rea'' * Concurring opinion (also called a "concurrence"), a ...
( multithreading and
distributed computing A distributed system is a system whose components are located on different computer network, networked computers, which communicate and coordinate their actions by message passing, passing messages to one another from any system. Distributed com ...
via
remote procedure call In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (l ...
s) and
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 th ...
.


Overview

Alice extends
Standard ML Standard ML (SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. It is popular among compiler writers and programming language researchers, as well as in the development of the ...
in a number of ways that distinguish it from its predecessor. Alice provides concurrency features as part of the base language through the use of a ''
future The future is the time after the past and present. Its arrival is considered inevitable due to the existence of time and the laws of physics. Due to the apparent nature of reality and the unavoidability of the future, everything that currently ...
'' type that represents a value being provided by an independent thread of execution. A thread that uses a future value will block on an attempt to access the value until the thread performing it has completed the computation. A related concept is also provided termed a ''
promise A promise is a commitment by someone to do or not do something. As a noun ''promise'' means a declaration assuring that one will or will not do something. As a verb it means to commit oneself by a promise to do or give. It can also mean a capacity ...
'', allowing a thread to provide a future value that it will compute to another thread. Future and promise typed variables are used to implement data-flow synchronizing. Like the
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
functional language, Alice provides facilities to allow a
lazy evaluation In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (sharing). The b ...
strategy in programs, unlike the traditional
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 f ...
strategy of Standard ML. While Haskell uses the lazy model by default, Alice uses an eager evaluation model by default, needing an explicit programming statement for a computation to evaluate lazily. The Alice implementation from Saarland University uses the Simple Extensible Abstract Machine (SEAM)
virtual machine In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
. It is
free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, no ...
, and features
just-in-time compilation In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may cons ...
to
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
and
native code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
for the
x86 architecture x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
. Early versions of Alice ran on the Mozart Programming System (Oz) virtual machine (VM), allowing interfacing between Alice and Oz code. Alice's remote procedure calling depends on the virtual machine, because it may send code to be computed from one computer to another.


Example

Alice extends Standard ML with several primitives for lazy evaluation and concurrency. For example, threads may be created using the spawn
keyword Keyword may refer to: Computing * Keyword (Internet search), a word or phrase typically used by bloggers or online content creator to rank a web page on a particular topic * Index term, a term used as a keyword to documents in an information syst ...
. Consider the naive algorithm for computing the
Fibonacci numbers In mathematics, the Fibonacci numbers, commonly denoted , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence commonly starts from 0 and 1, although some authors start the sequence from ...
: fun fib 0 = 0 , fib 1 = 1 , fib n = fib(n-1) + fib(n-2); For large values of ''n'', fib ''n'' will take a long time to compute. This computation can be performed in a separate thread by val x = spawn fib n; The variable x is now bound to a so-called ''
future The future is the time after the past and present. Its arrival is considered inevitable due to the existence of time and the laws of physics. Due to the apparent nature of reality and the unavoidability of the future, everything that currently ...
''. When an operation requires the value of x, it blocks until the thread is done with the computation. To exploit parallelism one could even define fib as follows: fun fib 0 = 0 , fib 1 = 1 , fib n = spawn fib(n-1) + fib(n-2);


See also

*
Oz (programming language) 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 Programmin ...


References


External links

* {{Official website, www.ps.uni-saarland.de/alice
Multiple publications about Alice ML and its concepts
ML programming language family Logic programming languages Functional logic programming languages Programming languages created in 2000