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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<!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> <span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> <span class="monospaced">in</span> <em>basdec</em> <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>
⇒
<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>
|