Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / StandardMLPortability
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>StandardMLPortability</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>StandardMLPortability</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
30 <div class="sectionbody">
31 <div class="paragraph"><p>Technically, SML&#8217;97 as defined in the
32 <a href="DefinitionOfStandardML">Definition</a>
33 requires only a minimal initial basis, which, while including the
34 types <span class="monospaced">int</span>, <span class="monospaced">real</span>, <span class="monospaced">char</span>, and <span class="monospaced">string</span>, need have
35 no operations on those base types. Hence, the only observable output
36 of an SML&#8217;97 program is termination or raising an exception. Most SML
37 compilers should agree there, to the degree each agrees with the
38 Definition. See <a href="UnresolvedBugs">UnresolvedBugs</a> for MLton&#8217;s very few corner cases.</p></div>
39 <div class="paragraph"><p>Realistically, a program needs to make use of the
40 <a href="BasisLibrary">Basis Library</a>.
41 Within the Basis Library, there are numerous places where the behavior
42 is implementation dependent. For a trivial example:</p></div>
43 <div class="listingblock">
44 <div class="content"><div class="highlight"><pre><span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">valOf</span><span class="w"> </span><span class="p">(</span><span class="n">Int</span><span class="p">.</span><span class="n">maxInt</span><span class="p">)</span><span class="w"></span>
45 </pre></div></div></div>
46 <div class="paragraph"><p>may either raise the <span class="monospaced">Option</span> exception (if
47 <span class="monospaced">Int.maxInt == NONE</span>) or may terminate normally. The default
48 Int/Real/Word sizes are the biggest implementation dependent aspect;
49 so, one implementation may raise <span class="monospaced">Overflow</span> while another can
50 accommodate the result. Also, maximum array and vector lengths are
51 implementation dependent. Interfacing with the operating system is a
52 bit murky, and implementations surely differ in handling of errors
53 there.</p></div>
54 </div>
55 </div>
56 </div>
57 <div id="footnotes"><hr></div>
58 <div id="footer">
59 <div id="footer-text">
60 </div>
61 <div id="footer-badges">
62 </div>
63 </div>
64 </body>
65 </html>