Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / StandardMLPortability
CommitLineData
7f918cf1
CE
1<!DOCTYPE html>\r
2<html lang="en">\r
3<head>\r
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
5<meta name="generator" content="AsciiDoc 8.6.9">\r
6<title>StandardMLPortability</title>\r
7<link rel="stylesheet" href="./asciidoc.css" type="text/css">\r
8<link rel="stylesheet" href="./pygments.css" type="text/css">\r
9\r
10\r
11<script type="text/javascript" src="./asciidoc.js"></script>\r
12<script type="text/javascript">\r
13/*<![CDATA[*/\r
14asciidoc.install();\r
15/*]]>*/\r
16</script>\r
17<link rel="stylesheet" href="./mlton.css" type="text/css">\r
18</head>\r
19<body class="article">\r
20<div id="banner">\r
21<div id="banner-home">\r
22<a href="./Home">MLton 20180207</a>\r
23</div>\r
24</div>\r
25<div id="header">\r
26<h1>StandardMLPortability</h1>\r
27</div>\r
28<div id="content">\r
29<div id="preamble">\r
30<div class="sectionbody">\r
31<div class="paragraph"><p>Technically, SML&#8217;97 as defined in the\r
32<a href="DefinitionOfStandardML">Definition</a>\r
33requires only a minimal initial basis, which, while including the\r
34types <span class="monospaced">int</span>, <span class="monospaced">real</span>, <span class="monospaced">char</span>, and <span class="monospaced">string</span>, need have\r
35no operations on those base types. Hence, the only observable output\r
36of an SML&#8217;97 program is termination or raising an exception. Most SML\r
37compilers should agree there, to the degree each agrees with the\r
38Definition. See <a href="UnresolvedBugs">UnresolvedBugs</a> for MLton&#8217;s very few corner cases.</p></div>\r
39<div class="paragraph"><p>Realistically, a program needs to make use of the\r
40<a href="BasisLibrary">Basis Library</a>.\r
41Within the Basis Library, there are numerous places where the behavior\r
42is implementation dependent. For a trivial example:</p></div>\r
43<div class="listingblock">\r
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>\r
45</pre></div></div></div>\r
46<div class="paragraph"><p>may either raise the <span class="monospaced">Option</span> exception (if\r
47<span class="monospaced">Int.maxInt == NONE</span>) or may terminate normally. The default\r
48Int/Real/Word sizes are the biggest implementation dependent aspect;\r
49so, one implementation may raise <span class="monospaced">Overflow</span> while another can\r
50accommodate the result. Also, maximum array and vector lengths are\r
51implementation dependent. Interfacing with the operating system is a\r
52bit murky, and implementations surely differ in handling of errors\r
53there.</p></div>\r
54</div>\r
55</div>\r
56</div>\r
57<div id="footnotes"><hr></div>\r
58<div id="footer">\r
59<div id="footer-text">\r
60</div>\r
61<div id="footer-badges">\r
62</div>\r
63</div>\r
64</body>\r
65</html>\r