<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.23">
<title>MLBasisAnnotations</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<link rel="stylesheet" href="./asciidoctor.css">
<link rel="stylesheet" href="./mlton.css">

</head>
<body class="article">
<div id="mlton-header">
<div id="mlton-header-text">
<h2>
<a href="./Home">
MLton
20241230
</a>
</h2>
</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</p>
</div>
<div class="sidebarblock">
<div class="content">
<div class="paragraph">
<p><code>ann</code> <code>"<em>ann</em>"</code> <code>in</code> <code><em>basdec</em></code> <code>end</code></p>
</div>
</div>
</div>
<div class="paragraph">
<p>merges the annotation <code><em>ann</em></code> with the "current" annotation
environment for the elaboration of <code><em>basdec</em></code>.  To allow for future
expansion, <code>"<em>ann</em>"</code> 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><code>ann</code> <code>"<em>ann</em></code> ( <code><em>ann</em>"</code> )<sup>&#43;</sup> <code>in</code> <code><em>basdec</em></code> <code>end</code>
&#8658;
<code>ann</code> <code>"<em>ann</em>"</code> <code>in</code> <code>ann</code> ( <code>"<em>ann</em>"</code> )<sup>&#43;</sup> <code>in</code> <code><em>basdec</em></code> <code>end</code> <code>end</code></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><code>allowFFI {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow <code>_address</code>, <code>_export</code>, <code>_import</code>, and <code>_symbol</code>
expressions to appear in source files.  See
<a href="ForeignFunctionInterface">ForeignFunctionInterface</a>.</p>
</div>
</li>
<li>
<p><code>allowSuccessorML {false|true}</code></p>
<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><code>allowDoDecls {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow a <code>do <em>exp</em></code> declaration form.</p>
</div>
</li>
<li>
<p><code>allowExtendedConsts {false|true}</code></p>
<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><code>allowExtendedNumConsts {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow extended numeric constants.</p>
</div>
</li>
<li>
<p><code>allowExtendedTextConsts {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow extended text constants.</p>
</div>
</li>
</ul>
</div>
</li>
<li>
<p><code>allowLineComments {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow line comments beginning with the token <code>(*)</code>.</p>
</div>
</li>
<li>
<p><code>allowOptBar {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow a bar to appear before the first match rule of a
<code>case</code>, <code>fn</code>, or <code>handle</code> expression, allow a bar to appear before the
first function-value binding of a <code>fun</code> declaration, and allow a bar
to appear before the first constructor binding or description of a
<code>datatype</code> declaration or specification.</p>
</div>
</li>
<li>
<p><code>allowOptSemicolon {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allows a semicolon to appear after the last expression in a
sequence expression or <code>let</code> body.</p>
</div>
</li>
<li>
<p><code>allowOrPats {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allows disjunctive (a.k.a., "or") patterns of the form
<code><em>pat</em> | <em>pat</em></code>.</p>
</div>
</li>
<li>
<p><code>allowRecordPunExps {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allows record punning expressions.</p>
</div>
</li>
<li>
<p><code>allowSigWithtype {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allows <code>withtype</code> to modify a <code>datatype</code> specification in a
signature.</p>
</div>
</li>
<li>
<p><code>allowVectorExpsAndPats {false|true}</code></p>
<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><code>allowVectorExps {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow vector expressions.</p>
</div>
</li>
<li>
<p><code>allowVectorPats {false|true}</code></p>
<div class="paragraph">
<p>If <code>true</code>, allow vector patterns.</p>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p><code>forceUsed</code></p>
<div class="paragraph">
<p>Force all identifiers in the basis denoted by the body of the <code>ann</code> to
be considered used; use in conjunction with <code>warnUnused true</code>.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveBind {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report nonexhaustive patterns in <code>val</code>
declarations (i.e., pattern-match failures that raise the <code>Bind</code>
exception).  An error will abort a compile, while a warning will not.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveExnBind {default|ignore}</code></p>
<div class="paragraph">
<p>If <code>ignore</code>, suppress errors and warnings about nonexhaustive matches
in <code>val</code> declarations that arise solely from unmatched exceptions.
If <code>default</code>, follow the behavior of <code>nonexhaustiveBind</code>.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveExnMatch {default|ignore}</code></p>
<div class="paragraph">
<p>If <code>ignore</code>, suppress errors and warnings about nonexhaustive matches
in <code>fn</code> expressions, <code>case</code> expressions, and <code>fun</code> declarations that
arise solely from unmatched exceptions.  If <code>default</code>, follow the
behavior of <code>nonexhaustiveMatch</code>.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveExnRaise {ignore|default}</code></p>
<div class="paragraph">
<p>If <code>ignore</code>, suppress errors and warnings about nonexhaustive matches
in <code>handle</code> expressions that arise solely from unmatched exceptions.
If <code>default</code>, follow the behavior of <code>nonexhaustiveRaise</code>.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveMatch {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report nonexhaustive patterns in <code>fn</code>
expressions, <code>case</code> expressions, and <code>fun</code> declarations (i.e.,
pattern-match failures that raise the <code>Match</code> exception).  An error
will abort a compile, while a warning will not.</p>
</div>
</li>
<li>
<p><code>nonexhaustiveRaise {ignore|warn|error}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report nonexhaustive patterns in <code>handle</code>
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><code>redundantBind {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report redundant patterns in <code>val</code> declarations.
An error will abort a compile, while a warning will not.</p>
</div>
</li>
<li>
<p><code>redundantMatch {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report redundant patterns in <code>fn</code> expressions,
<code>case</code> expressions, and <code>fun</code> declarations.  An error will abort a
compile, while a warning will not.</p>
</div>
</li>
<li>
<p><code>redundantRaise {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report redundant patterns in <code>handle</code>
expressions.  An error will abort a compile, while a warning will not.</p>
</div>
</li>
<li>
<p><code>resolveScope {strdec|dec|topdec|program}</code></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 <code>.sml</code> file and does not
correspond to the whole <code>.mlb</code> program).</p>
</div>
</li>
<li>
<p><code>sequenceNonUnit {ignore|error|warn}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report when <code>e1</code> is not of type <code>unit</code> in the
sequence expression <code>(e1; e2)</code>.  This can be helpful in detecting
curried applications that are mistakenly not fully applied.  To
silence spurious messages, you can use <code>ignore e1</code>.</p>
</div>
</li>
<li>
<p><code>valrecConstr {warn|error|ignore}</code></p>
<div class="paragraph">
<p>If <code>error</code> or <code>warn</code>, report when a <code>val rec</code> (or <code>fun</code>) 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><code>warnUnused {false|true}</code></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="mlton-footer">
<div id="mlton-footer-text">
<div>
Last updated Thu Oct 21 15:53:06 2021 -0400 by Matthew Fluet.
<a href="https://github.com/MLton/mlton/commits/master/doc/guide/src/MLBasisAnnotations.adoc">Log</a>
<a href="https://github.com/MLton/mlton/edit/master/doc/guide/src/MLBasisAnnotations.adoc">Edit</a>
</div>
</div>
</body>
</html>