This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Alice" programming language – news ·newspapers ·books ·scholar ·JSTOR(February 2011) (Learn how and when to remove this message) |
| Alice | |
|---|---|
| Paradigms | Multi-paradigm:imperative,functional,distributed,concurrent,constraint |
| Family | ML:Standard ML |
| Developer | Saarland University |
| First appeared | June 16, 2000; 25 years ago (2000-06-16) |
| Stable release | 1.4 / May 3, 2007; 18 years ago (2007-05-03) |
| Typing discipline | strong,static,inferred |
| OS | Cross-platform |
| License | MIT |
| Website | www |
| Influenced by | |
| ML,Oz | |
Alice ML is ageneral-purpose,high-level,multi-paradigm,functionalprogramming language designed by the Programming Systems Laboratory atSaarland University,Saarbrücken,Germany.[2] It is adialect ofStandard ML, augmented with support forlazy evaluation,concurrency (multithreading anddistributed computing viaremote procedure calls) andconstraint programming.
Alice extendsStandard ML 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 afuture 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 apromise, 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 theHaskell functional language, Alice provides facilities to allow alazy evaluation strategy in programs, unlike the traditionaleager evaluation 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. It isfree software, and featuresjust-in-time compilation tobytecode andnative code for thex86 architecture.
Early versions of Alice ran on the Mozart Programming System (Oz) virtual machine (VM), allowing interfacing between Alice andOz code.
Alice's remote procedure calling depends on the virtual machine, because it may send code to be computed from one computer to another.
Alice extends Standard ML with several primitives for lazy evaluation and concurrency. For example, threads may be created using thespawnkeyword. Consider the naive algorithm for computing theFibonacci numbers:
funfib0=0|fib1=1|fibn=fib(n-1)+fib(n-2);
For large values ofn,fibn will take a long time to compute. This computation can be performed in a separate thread by
valx=spawnfibn;
The variablex is now bound to a so-calledfuture. When an operation requires the value ofx, it blocks until the thread is done with the computation. To exploit parallelism one could even define fib as follows:
funfib0=0|fib1=1|fibn=spawnfib(n-1)+fib(n-2);