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