Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / Features
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>Features</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>Features</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
30 <div class="sectionbody">
31 <div class="paragraph"><p>MLton has the following features.</p></div>
32 </div>
33 </div>
34 <div class="sect1">
35 <h2 id="_portability">Portability</h2>
36 <div class="sectionbody">
37 <div class="ulist"><ul>
38 <li>
39 <p>
40 Runs on a variety of platforms.
41 </p>
42 <div class="ulist"><ul>
43 <li>
44 <p>
45 <a href="RunningOnARM">ARM</a>:
46 </p>
47 <div class="ulist"><ul>
48 <li>
49 <p>
50 <a href="RunningOnLinux">Linux</a> (Debian)
51 </p>
52 </li>
53 </ul></div>
54 </li>
55 <li>
56 <p>
57 <a href="RunningOnAlpha">Alpha</a>:
58 </p>
59 <div class="ulist"><ul>
60 <li>
61 <p>
62 <a href="RunningOnLinux">Linux</a> (Debian)
63 </p>
64 </li>
65 </ul></div>
66 </li>
67 <li>
68 <p>
69 <a href="RunningOnAMD64">AMD64</a>:
70 </p>
71 <div class="ulist"><ul>
72 <li>
73 <p>
74 <a href="RunningOnDarwin">Darwin</a> (Mac OS X)
75 </p>
76 </li>
77 <li>
78 <p>
79 <a href="RunningOnFreeBSD">FreeBSD</a>
80 </p>
81 </li>
82 <li>
83 <p>
84 <a href="RunningOnLinux">Linux</a> (Debian, Fedora, Ubuntu, &#8230;)
85 </p>
86 </li>
87 <li>
88 <p>
89 <a href="RunningOnOpenBSD">OpenBSD</a>
90 </p>
91 </li>
92 <li>
93 <p>
94 <a href="RunningOnSolaris">Solaris</a> (10 and above)
95 </p>
96 </li>
97 </ul></div>
98 </li>
99 <li>
100 <p>
101 <a href="RunningOnHPPA">HPPA</a>:
102 </p>
103 <div class="ulist"><ul>
104 <li>
105 <p>
106 <a href="RunningOnHPUX">HPUX</a> (11.11 and above)
107 </p>
108 </li>
109 <li>
110 <p>
111 <a href="RunningOnLinux">Linux</a> (Debian)
112 </p>
113 </li>
114 </ul></div>
115 </li>
116 <li>
117 <p>
118 <a href="RunningOnIA64">IA64</a>:
119 </p>
120 <div class="ulist"><ul>
121 <li>
122 <p>
123 <a href="RunningOnHPUX">HPUX</a> (11.11 and above)
124 </p>
125 </li>
126 <li>
127 <p>
128 <a href="RunningOnLinux">Linux</a> (Debian)
129 </p>
130 </li>
131 </ul></div>
132 </li>
133 <li>
134 <p>
135 <a href="RunningOnPowerPC">PowerPC</a>:
136 </p>
137 <div class="ulist"><ul>
138 <li>
139 <p>
140 <a href="RunningOnAIX">AIX</a> (5.2 and above)
141 </p>
142 </li>
143 <li>
144 <p>
145 <a href="RunningOnDarwin">Darwin</a> (Mac OS X)
146 </p>
147 </li>
148 <li>
149 <p>
150 <a href="RunningOnLinux">Linux</a> (Debian, Fedora, &#8230;)
151 </p>
152 </li>
153 </ul></div>
154 </li>
155 <li>
156 <p>
157 <a href="RunningOnPowerPC64">PowerPC64</a>:
158 </p>
159 <div class="ulist"><ul>
160 <li>
161 <p>
162 <a href="RunningOnAIX">AIX</a> (5.2 and above)
163 </p>
164 </li>
165 </ul></div>
166 </li>
167 <li>
168 <p>
169 <a href="RunningOnS390">S390</a>
170 </p>
171 <div class="ulist"><ul>
172 <li>
173 <p>
174 <a href="RunningOnLinux">Linux</a> (Debian)
175 </p>
176 </li>
177 </ul></div>
178 </li>
179 <li>
180 <p>
181 <a href="RunningOnSparc">Sparc</a>
182 </p>
183 <div class="ulist"><ul>
184 <li>
185 <p>
186 <a href="RunningOnLinux">Linux</a> (Debian)
187 </p>
188 </li>
189 <li>
190 <p>
191 <a href="RunningOnSolaris">Solaris</a> (8 and above)
192 </p>
193 </li>
194 </ul></div>
195 </li>
196 <li>
197 <p>
198 <a href="RunningOnX86">X86</a>:
199 </p>
200 <div class="ulist"><ul>
201 <li>
202 <p>
203 <a href="RunningOnCygwin">Cygwin</a>/Windows
204 </p>
205 </li>
206 <li>
207 <p>
208 <a href="RunningOnDarwin">Darwin</a> (Mac OS X)
209 </p>
210 </li>
211 <li>
212 <p>
213 <a href="RunningOnFreeBSD">FreeBSD</a>
214 </p>
215 </li>
216 <li>
217 <p>
218 <a href="RunningOnLinux">Linux</a> (Debian, Fedora, Ubuntu, &#8230;)
219 </p>
220 </li>
221 <li>
222 <p>
223 <a href="RunningOnMinGW">MinGW</a>/Windows
224 </p>
225 </li>
226 <li>
227 <p>
228 <a href="RunningOnNetBSD">NetBSD</a>
229 </p>
230 </li>
231 <li>
232 <p>
233 <a href="RunningOnOpenBSD">OpenBSD</a>
234 </p>
235 </li>
236 <li>
237 <p>
238 <a href="RunningOnSolaris">Solaris</a> (10 and above)
239 </p>
240 </li>
241 </ul></div>
242 </li>
243 </ul></div>
244 </li>
245 </ul></div>
246 </div>
247 </div>
248 <div class="sect1">
249 <h2 id="_robustness">Robustness</h2>
250 <div class="sectionbody">
251 <div class="ulist"><ul>
252 <li>
253 <p>
254 Supports the full SML 97 language as given in <a href="DefinitionOfStandardML">The Definition of Standard ML (Revised)</a>.
255 </p>
256 <div class="paragraph"><p>If there is a program that is valid according to the
257 <a href="DefinitionOfStandardML">Definition</a> that is rejected by MLton, or a
258 program that is invalid according to the
259 <a href="DefinitionOfStandardML">Definition</a> that is accepted by MLton, it is
260 a bug. For a list of known bugs, see <a href="UnresolvedBugs">UnresolvedBugs</a>.</p></div>
261 </li>
262 <li>
263 <p>
264 A complete implementation of the <a href="BasisLibrary">Basis Library</a>.
265 </p>
266 <div class="paragraph"><p>MLton&#8217;s implementation matches latest <a href="BasisLibrary">Basis Library</a>
267 <a href="http://www.standardml.org/Basis">specification</a>, and includes a
268 complete implementation of all the required modules, as well as many
269 of the optional modules.</p></div>
270 </li>
271 <li>
272 <p>
273 Generates standalone executables.
274 </p>
275 <div class="paragraph"><p>No additional code or libraries are necessary in order to run an
276 executable, except for the standard shared libraries. MLton can also
277 generate statically linked executables.</p></div>
278 </li>
279 <li>
280 <p>
281 Compiles large programs.
282 </p>
283 <div class="paragraph"><p>MLton is sufficiently efficient and robust that it can compile large
284 programs, including itself (over 190K lines). The distributed version
285 of MLton was compiled by MLton.</p></div>
286 </li>
287 <li>
288 <p>
289 Support for large amounts of memory (up to 4G on 32-bit systems; more on 64-bit systems).
290 </p>
291 </li>
292 <li>
293 <p>
294 Support for large array lengths (up to 2<sup>31</sup>-1 on 32-bit systems; up to 2<sup>63</sup>-1 on 64-bit systems).
295 </p>
296 </li>
297 <li>
298 <p>
299 Support for large files, using 64-bit file positions.
300 </p>
301 </li>
302 </ul></div>
303 </div>
304 </div>
305 <div class="sect1">
306 <h2 id="_performance">Performance</h2>
307 <div class="sectionbody">
308 <div class="ulist"><ul>
309 <li>
310 <p>
311 Executables have <a href="Performance">excellent running times</a>.
312 </p>
313 </li>
314 <li>
315 <p>
316 Generates small executables.
317 </p>
318 <div class="paragraph"><p>MLton takes advantage of whole-program compilation to perform very
319 aggressive dead-code elimination, which often leads to smaller
320 executables than with other SML compilers.</p></div>
321 </li>
322 <li>
323 <p>
324 Untagged and unboxed native integers, reals, and words.
325 </p>
326 <div class="paragraph"><p>In MLton, integers and words are 8 bits, 16 bits, 32 bits, and 64 bits
327 and arithmetic does not have any overhead due to tagging or boxing.
328 Also, reals (32-bit and 64-bit) are stored unboxed, avoiding any
329 overhead due to boxing.</p></div>
330 </li>
331 <li>
332 <p>
333 Unboxed native arrays.
334 </p>
335 <div class="paragraph"><p>In MLton, an array (or vector) of integers, reals, or words uses the
336 natural C-like representation. This is fast and supports easy
337 exchange of data with C. Monomorphic arrays (and vectors) use the
338 same C-like representations as their polymorphic counterparts.</p></div>
339 </li>
340 <li>
341 <p>
342 Multiple <a href="GarbageCollection">garbage collection</a> strategies.
343 </p>
344 </li>
345 <li>
346 <p>
347 Fast arbitrary precision arithmetic (<span class="monospaced">IntInf</span>) based on <a href="GnuMP">GnuMP</a>.
348 </p>
349 <div class="paragraph"><p>For <span class="monospaced">IntInf</span> intensive programs, MLton can be an order of magnitude or
350 more faster than Poly/ML or SML/NJ.</p></div>
351 </li>
352 </ul></div>
353 </div>
354 </div>
355 <div class="sect1">
356 <h2 id="_tools">Tools</h2>
357 <div class="sectionbody">
358 <div class="ulist"><ul>
359 <li>
360 <p>
361 Source-level <a href="Profiling">Profiling</a> of both time and allocation.
362 </p>
363 </li>
364 <li>
365 <p>
366 <a href="MLLex">MLLex</a> lexer generator
367 </p>
368 </li>
369 <li>
370 <p>
371 <a href="MLYacc">MLYacc</a> parser generator
372 </p>
373 </li>
374 <li>
375 <p>
376 <a href="MLNLFFIGen">MLNLFFIGen</a> foreign-function-interface generator
377 </p>
378 </li>
379 </ul></div>
380 </div>
381 </div>
382 <div class="sect1">
383 <h2 id="_extensions">Extensions</h2>
384 <div class="sectionbody">
385 <div class="ulist"><ul>
386 <li>
387 <p>
388 A simple and fast C <a href="ForeignFunctionInterface">ForeignFunctionInterface</a> that supports calling from SML to C and from C to SML.
389 </p>
390 </li>
391 <li>
392 <p>
393 The <a href="MLBasis">ML Basis system</a> for programming in the very large, separate delivery of library sources, and more.
394 </p>
395 </li>
396 <li>
397 <p>
398 A number of extension libraries that provide useful functionality
399 that cannot be implemented with the <a href="BasisLibrary">Basis Library</a>.
400 See below for an overview and <a href="MLtonStructure">MLtonStructure</a> for details.
401 </p>
402 <div class="ulist"><ul>
403 <li>
404 <p>
405 <a href="MLtonCont">continuations</a>
406 </p>
407 <div class="paragraph"><p>MLton supports continuations via <span class="monospaced">callcc</span> and <span class="monospaced">throw</span>.</p></div>
408 </li>
409 <li>
410 <p>
411 <a href="MLtonFinalizable">finalization</a>
412 </p>
413 <div class="paragraph"><p>MLton supports finalizable values of arbitrary type.</p></div>
414 </li>
415 <li>
416 <p>
417 <a href="MLtonItimer">interval timers</a>
418 </p>
419 <div class="paragraph"><p>MLton supports the functionality of the C <span class="monospaced">setitimer</span> function.</p></div>
420 </li>
421 <li>
422 <p>
423 <a href="MLtonRandom">random numbers</a>
424 </p>
425 <div class="paragraph"><p>MLton has functions similar to the C <span class="monospaced">rand</span> and <span class="monospaced">srand</span> functions, as well as support for access to <span class="monospaced">/dev/random</span> and <span class="monospaced">/dev/urandom</span>.</p></div>
426 </li>
427 <li>
428 <p>
429 <a href="MLtonRlimit">resource limits</a>
430 </p>
431 <div class="paragraph"><p>MLton has functions similar to the C <span class="monospaced">getrlimit</span> and <span class="monospaced">setrlimit</span> functions.</p></div>
432 </li>
433 <li>
434 <p>
435 <a href="MLtonRusage">resource usage</a>
436 </p>
437 <div class="paragraph"><p>MLton supports a subset of the functionality of the C <span class="monospaced">getrusage</span> function.</p></div>
438 </li>
439 <li>
440 <p>
441 <a href="MLtonSignal">signal handlers</a>
442 </p>
443 <div class="paragraph"><p>MLton supports signal handlers written in SML. Signal handlers run in
444 a separate MLton thread, and have access to the thread that was
445 interrupted by the signal. Signal handlers can be used in conjunction
446 with threads to implement preemptive multitasking.</p></div>
447 </li>
448 <li>
449 <p>
450 <a href="MLtonStructure">size primitive</a>
451 </p>
452 <div class="paragraph"><p>MLton includes a primitive that returns the size (in bytes) of any
453 object. This can be useful in understanding the space behavior of a
454 program.</p></div>
455 </li>
456 <li>
457 <p>
458 <a href="MLtonSyslog">system logging</a>
459 </p>
460 <div class="paragraph"><p>MLton has a complete interface to the C <span class="monospaced">syslog</span> function.</p></div>
461 </li>
462 <li>
463 <p>
464 <a href="MLtonThread">threads</a>
465 </p>
466 <div class="paragraph"><p>MLton has support for its own threads, upon which either preemptive or
467 non-preemptive multitasking can be implemented. MLton also has
468 support for <a href="ConcurrentML">Concurrent ML</a> (CML).</p></div>
469 </li>
470 <li>
471 <p>
472 <a href="MLtonWeak">weak pointers</a>
473 </p>
474 <div class="paragraph"><p>MLton supports weak pointers, which allow the garbage collector to
475 reclaim objects that it would otherwise be forced to keep. Weak
476 pointers are also used to provide finalization.</p></div>
477 </li>
478 <li>
479 <p>
480 <a href="MLtonWorld">world save and restore</a>
481 </p>
482 <div class="paragraph"><p>MLton has a facility for saving the entire state of a computation to a
483 file and restarting it later. This facility can be used for staging
484 and for checkpointing computations. It can even be used from within
485 signal handlers, allowing interrupt driven checkpointing.</p></div>
486 </li>
487 </ul></div>
488 </li>
489 </ul></div>
490 </div>
491 </div>
492 </div>
493 <div id="footnotes"><hr></div>
494 <div id="footer">
495 <div id="footer-text">
496 </div>
497 <div id="footer-badges">
498 </div>
499 </div>
500 </body>
501 </html>