<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.9">
<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 20180207</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">allowSuccessorML {false|true}</span>
</p>
<div class="openblock">
<div class="content">
<div class="paragraph"><p>Allow or disallow all of the <a href="SuccessorML">SuccessorML</a> features.  This is a
proxy for all of the following annotations.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">allowDoDecls {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow a <span class="monospaced">do <em>exp</em></span> declaration form.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowExtendedConsts {false|true}</span>
</p>
<div class="openblock">
<div class="content">
<div class="paragraph"><p>Allow or disallow all of the extended constants features.  This is a
proxy for all of the following annotations.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">allowExtendedNumConsts {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow extended numeric constants.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowExtendedTextConsts {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow extended text constants.</p></div>
</li>
</ul></div>
</div></div>
</li>
<li>
<p>
<span class="monospaced">allowLineComments {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow line comments beginning with the token <span class="monospaced">(*)</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowOptBar {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow a bar to appear before the first match rule of a
<span class="monospaced">case</span>, <span class="monospaced">fn</span>, or <span class="monospaced">handle</span> expression, allow a bar to appear before the
first function-value binding of a <span class="monospaced">fun</span> declaration, and allow a bar
to appear before the first constructor binding or description of a
<span class="monospaced">datatype</span> declaration or specification.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowOptSemicolon {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allows a semicolon to appear after the last expression in a
sequence expression or <span class="monospaced">let</span> body.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowOrPats {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allows disjunctive (a.k.a., "or") patterns of the form
<span class="monospaced"><em>pat</em> | <em>pat</em></span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowRecordPunExps {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allows record punning expressions.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowSigWithtype {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allows <span class="monospaced">withtype</span> to modify a <span class="monospaced">datatype</span> specification in a
signature.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowVectorExpsAndPats {false|true}</span>
</p>
<div class="openblock">
<div class="content">
<div class="paragraph"><p>Allow or disallow vector expressions and vector patterns.  This is a
proxy for all of the following annotations.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">allowVectorExps {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow vector expressions.</p></div>
</li>
<li>
<p>
<span class="monospaced">allowVectorPats {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, allow vector patterns.</p></div>
</li>
</ul></div>
</div></div>
</li>
</ul></div>
</div></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">nonexhaustiveBind {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report nonexhaustive patterns in <span class="monospaced">val</span>
declarations (i.e., pattern-match failures that raise the <span class="monospaced">Bind</span>
exception).  An error will abort a compile, while a warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">nonexhaustiveExnBind {default|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches
in <span class="monospaced">val</span> declarations that arise solely from unmatched exceptions.
If <span class="monospaced">default</span>, follow the behavior of <span class="monospaced">nonexhaustiveBind</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
in <span class="monospaced">fn</span> expressions, <span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations 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">nonexhaustiveExnRaise {ignore|default}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches
in <span class="monospaced">handle</span> expressions that arise solely from unmatched exceptions.
If <span class="monospaced">default</span>, follow the behavior of <span class="monospaced">nonexhaustiveRaise</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 patterns in <span class="monospaced">fn</span>
expressions, <span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations (i.e.,
pattern-match failures that raise the <span class="monospaced">Match</span> exception).  An error
will abort a compile, while a warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">nonexhaustiveRaise {ignore|warn|error}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report nonexhaustive patterns in <span class="monospaced">handle</span>
expressions (i.e., pattern-match failures that implicitly (re)raise
the unmatched exception).  An error will abort a compile, while a
warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">redundantBind {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report redundant patterns in <span class="monospaced">val</span> declarations.
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 patterns in <span class="monospaced">fn</span> expressions,
<span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations.  An error will abort a
compile, while a warning will not.</p></div>
</li>
<li>
<p>
<span class="monospaced">redundantRaise {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report redundant patterns in <span class="monospaced">handle</span>
expressions.  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">valrecConstr {warn|error|ignore}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">error</span> or <span class="monospaced">warn</span>, report when a <span class="monospaced">val rec</span> (or <span class="monospaced">fun</span>) declaration
redefines an identifier that previously had constructor status.  An
error will abort a compile, while a warning will not.</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>
