<!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&#8217;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&#8217;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&#8217;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>
