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">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
26 <h1>StandardMLPortability</h1>
30 <div class="sectionbody">
31 <div class="paragraph"><p>Technically, SML’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’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’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
57 <div id="footnotes"><hr></div>
59 <div id="footer-text">
61 <div id="footer-badges">