Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / Features.adoc
CommitLineData
7f918cf1
CE
1Features
2========
3
4MLton has the following features.
5
6== Portability ==
7
8* Runs on a variety of platforms.
9
10** <:RunningOnARM:ARM>:
11*** <:RunningOnLinux:Linux> (Debian)
12
13** <:RunningOnAlpha:Alpha>:
14*** <:RunningOnLinux:Linux> (Debian)
15
16** <:RunningOnAMD64:AMD64>:
17*** <:RunningOnDarwin:Darwin> (Mac OS X)
18*** <:RunningOnFreeBSD:FreeBSD>
19*** <:RunningOnLinux:Linux> (Debian, Fedora, Ubuntu, ...)
20*** <:RunningOnOpenBSD:OpenBSD>
21*** <:RunningOnSolaris:Solaris> (10 and above)
22
23** <:RunningOnHPPA:HPPA>:
24*** <:RunningOnHPUX:HPUX> (11.11 and above)
25*** <:RunningOnLinux:Linux> (Debian)
26
27** <:RunningOnIA64:IA64>:
28*** <:RunningOnHPUX:HPUX> (11.11 and above)
29*** <:RunningOnLinux:Linux> (Debian)
30
31** <:RunningOnPowerPC:PowerPC>:
32*** <:RunningOnAIX:AIX> (5.2 and above)
33*** <:RunningOnDarwin:Darwin> (Mac OS X)
34*** <:RunningOnLinux:Linux> (Debian, Fedora, ...)
35
36** <:RunningOnPowerPC64:PowerPC64>:
37*** <:RunningOnAIX:AIX> (5.2 and above)
38
39** <:RunningOnS390:S390>
40*** <:RunningOnLinux:Linux> (Debian)
41
42** <:RunningOnSparc:Sparc>
43*** <:RunningOnLinux:Linux> (Debian)
44*** <:RunningOnSolaris:Solaris> (8 and above)
45
46** <:RunningOnX86:X86>:
47*** <:RunningOnCygwin:Cygwin>/Windows
48*** <:RunningOnDarwin:Darwin> (Mac OS X)
49*** <:RunningOnFreeBSD:FreeBSD>
50*** <:RunningOnLinux:Linux> (Debian, Fedora, Ubuntu, ...)
51*** <:RunningOnMinGW:MinGW>/Windows
52*** <:RunningOnNetBSD:NetBSD>
53*** <:RunningOnOpenBSD:OpenBSD>
54*** <:RunningOnSolaris:Solaris> (10 and above)
55
56== Robustness ==
57
58* Supports the full SML 97 language as given in <:DefinitionOfStandardML:The Definition of Standard ML (Revised)>.
59+
60If there is a program that is valid according to the
61<:DefinitionOfStandardML:Definition> that is rejected by MLton, or a
62program that is invalid according to the
63<:DefinitionOfStandardML:Definition> that is accepted by MLton, it is
64a bug. For a list of known bugs, see <:UnresolvedBugs:>.
65
66* A complete implementation of the <:BasisLibrary:Basis Library>.
67+
68MLton's implementation matches latest <:BasisLibrary:Basis Library>
69http://www.standardml.org/Basis[specification], and includes a
70complete implementation of all the required modules, as well as many
71of the optional modules.
72
73* Generates standalone executables.
74+
75No additional code or libraries are necessary in order to run an
76executable, except for the standard shared libraries. MLton can also
77generate statically linked executables.
78
79* Compiles large programs.
80+
81MLton is sufficiently efficient and robust that it can compile large
82programs, including itself (over 190K lines). The distributed version
83of MLton was compiled by MLton.
84
85* Support for large amounts of memory (up to 4G on 32-bit systems; more on 64-bit systems).
86
87* Support for large array lengths (up to 2^31^-1 on 32-bit systems; up to 2^63^-1 on 64-bit systems).
88
89* Support for large files, using 64-bit file positions.
90
91== Performance ==
92
93* Executables have <:Performance:excellent running times>.
94
95* Generates small executables.
96+
97MLton takes advantage of whole-program compilation to perform very
98aggressive dead-code elimination, which often leads to smaller
99executables than with other SML compilers.
100
101* Untagged and unboxed native integers, reals, and words.
102+
103In MLton, integers and words are 8 bits, 16 bits, 32 bits, and 64 bits
104and arithmetic does not have any overhead due to tagging or boxing.
105Also, reals (32-bit and 64-bit) are stored unboxed, avoiding any
106overhead due to boxing.
107
108* Unboxed native arrays.
109+
110In MLton, an array (or vector) of integers, reals, or words uses the
111natural C-like representation. This is fast and supports easy
112exchange of data with C. Monomorphic arrays (and vectors) use the
113same C-like representations as their polymorphic counterparts.
114
115* Multiple <:GarbageCollection:garbage collection> strategies.
116
117* Fast arbitrary precision arithmetic (`IntInf`) based on <:GnuMP:>.
118+
119For `IntInf` intensive programs, MLton can be an order of magnitude or
120more faster than Poly/ML or SML/NJ.
121
122== Tools ==
123
124* Source-level <:Profiling:> of both time and allocation.
125* <:MLLex:> lexer generator
126* <:MLYacc:> parser generator
127* <:MLNLFFIGen:> foreign-function-interface generator
128
129== Extensions ==
130
131* A simple and fast C <:ForeignFunctionInterface:> that supports calling from SML to C and from C to SML.
132
133* The <:MLBasis:ML Basis system> for programming in the very large, separate delivery of library sources, and more.
134
135* A number of extension libraries that provide useful functionality
136that cannot be implemented with the <:BasisLibrary:Basis Library>.
137See below for an overview and <:MLtonStructure:> for details.
138
139** <:MLtonCont:continuations>
140+
141MLton supports continuations via `callcc` and `throw`.
142
143** <:MLtonFinalizable:finalization>
144+
145MLton supports finalizable values of arbitrary type.
146
147** <:MLtonItimer:interval timers>
148+
149MLton supports the functionality of the C `setitimer` function.
150
151** <:MLtonRandom:random numbers>
152+
153MLton has functions similar to the C `rand` and `srand` functions, as well as support for access to `/dev/random` and `/dev/urandom`.
154
155** <:MLtonRlimit:resource limits>
156+
157MLton has functions similar to the C `getrlimit` and `setrlimit` functions.
158
159** <:MLtonRusage:resource usage>
160+
161MLton supports a subset of the functionality of the C `getrusage` function.
162
163** <:MLtonSignal:signal handlers>
164+
165MLton supports signal handlers written in SML. Signal handlers run in
166a separate MLton thread, and have access to the thread that was
167interrupted by the signal. Signal handlers can be used in conjunction
168with threads to implement preemptive multitasking.
169
170** <:MLtonStructure:size primitive>
171+
172MLton includes a primitive that returns the size (in bytes) of any
173object. This can be useful in understanding the space behavior of a
174program.
175
176** <:MLtonSyslog:system logging>
177+
178MLton has a complete interface to the C `syslog` function.
179
180** <:MLtonThread:threads>
181+
182MLton has support for its own threads, upon which either preemptive or
183non-preemptive multitasking can be implemented. MLton also has
184support for <:ConcurrentML:Concurrent ML> (CML).
185
186** <:MLtonWeak:weak pointers>
187+
188MLton supports weak pointers, which allow the garbage collector to
189reclaim objects that it would otherwise be forced to keep. Weak
190pointers are also used to provide finalization.
191
192** <:MLtonWorld:world save and restore>
193+
194MLton has a facility for saving the entire state of a computation to a
195file and restarting it later. This facility can be used for staging
196and for checkpointing computations. It can even be used from within
197signal handlers, allowing interrupt driven checkpointing.