<!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>MLBasisAnnotations</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>MLBasisAnnotations</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p><a href="MLBasis">ML Basis</a> annotations control options that affect the
elaboration of SML source files.  Conceptually, a basis file is
elaborated in a default annotation environment (just as it is
elaborated in an empty basis).  The declaration
<span class="monospaced">ann</span>&#160;<span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span>&#160;<span class="monospaced">in</span>&#160;<em>basdec</em>&#160;<span class="monospaced">end</span>
merges the annotation <em>ann</em> with the "current" annotation environment
for the elaboration of <em>basdec</em>.  To allow for future expansion,
<span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> is lexed as a single SML string constant.  To
conveniently specify multiple annotations, the following derived form
is provided:</p></div>
<div class="sidebarblock">
<div class="content">
<div class="paragraph"><p><span class="monospaced">ann</span> <span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> (<span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> )<sup>+</sup> <span class="monospaced">in</span> <em>basdec</em> <span class="monospaced">end</span>
&#8658;
<span class="monospaced">ann</span> <span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> <span class="monospaced">in</span> <span class="monospaced">ann</span> (<span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span>)<sup>+</sup> <span class="monospaced">in</span> <em>basdec</em> <span class="monospaced">end</span> <span class="monospaced">end</span></p></div>
</div></div>
<div class="paragraph"><p>Here are the available annotations.  In the explanation below, for
annotations that take an argument, the first value listed is the
default.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">allowFFI {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow <span class="monospaced">_address</span>, <span class="monospaced">_export</span>, <span class="monospaced">_import</span>, and <span class="monospaced">_symbol</span>
expressions to appear in source files.  See
<a href="ForeignFunctionInterface">ForeignFunctionInterface</a>.</p></div>
</li>
<li>
<p>
<span class="monospaced">forceUsed</span>
</p>
<div class="paragraph"><p>Force all identifiers in the basis denoted by the body of the <span class="monospaced">ann</span> to
be considered used; use in conjunction with <span class="monospaced">warnUnused true</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">nonexhaustiveExnMatch {default|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches
that arise solely from unmatched exceptions.  If <span class="monospaced">default</span>, follow the
behavior of <span class="monospaced">nonexhaustiveMatch</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">nonexhaustiveMatch {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report nonexhaustive matches.  An error will
abort a compile, while a warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">redundantMatch {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report redundant matches.  An error will abort a
compile, while a warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">resolveScope {strdec|dec|topdec|program}</span>
</p>
<div class="paragraph"><p>Used to control the scope at which overload constraints are resolved
to default types (if not otherwise resolved by type inference) and the
scope at which unresolved flexible record constraints are reported.</p></div>
<div class="paragraph"><p>The syntactic-class argument means to perform resolution checks at the
smallest enclosing syntactic form of the given class.  The default
behavior is to resolve at the smallest enclosing <em>strdec</em> (which is
equivalent to the largest enclosing <em>dec</em>).  Other useful behaviors
are to resolve at the smallest enclosing <em>topdec</em> (which is equivalent
to the largest enclosing <em>strdec</em>) and at the smallest enclosing
<em>program</em> (which corresponds to a single <span class="monospaced">.sml</span> file and does not
correspond to the whole <span class="monospaced">.mlb</span> program).</p></div>
</li>
<li>
<p>
<span class="monospaced">sequenceNonUnit {ignore|error|warn}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report when <span class="monospaced">e1</span> is not of type <span class="monospaced">unit</span> in the
sequence expression <span class="monospaced">(e1; e2)</span>.  This can be helpful in detecting
curried applications that are mistakenly not fully applied.  To
silence spurious messages, you can use <span class="monospaced">ignore e1</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">warnUnused {false|true}</span>
</p>
<div class="paragraph"><p>Report unused identifiers.</p></div>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_next_steps">Next Steps</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
<a href="MLBasisAnnotationExamples">MLBasisAnnotationExamples</a>
</p>
</li>
<li>
<p>
<a href="WarnUnusedAnomalies">WarnUnusedAnomalies</a>
</p>
</li>
</ul></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>
