Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | <!DOCTYPE html>\r |
2 | <html lang="en">\r | |
3 | <head>\r | |
4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r | |
5 | <meta name="generator" content="AsciiDoc 8.6.9">\r | |
6 | <title>MLBasisAnnotations</title>\r | |
7 | <link rel="stylesheet" href="./asciidoc.css" type="text/css">\r | |
8 | <link rel="stylesheet" href="./pygments.css" type="text/css">\r | |
9 | \r | |
10 | \r | |
11 | <script type="text/javascript" src="./asciidoc.js"></script>\r | |
12 | <script type="text/javascript">\r | |
13 | /*<![CDATA[*/\r | |
14 | asciidoc.install();\r | |
15 | /*]]>*/\r | |
16 | </script>\r | |
17 | <link rel="stylesheet" href="./mlton.css" type="text/css">\r | |
18 | </head>\r | |
19 | <body class="article">\r | |
20 | <div id="banner">\r | |
21 | <div id="banner-home">\r | |
22 | <a href="./Home">MLton 20180207</a>\r | |
23 | </div>\r | |
24 | </div>\r | |
25 | <div id="header">\r | |
26 | <h1>MLBasisAnnotations</h1>\r | |
27 | </div>\r | |
28 | <div id="content">\r | |
29 | <div id="preamble">\r | |
30 | <div class="sectionbody">\r | |
31 | <div class="paragraph"><p><a href="MLBasis">ML Basis</a> annotations control options that affect the\r | |
32 | elaboration of SML source files. Conceptually, a basis file is\r | |
33 | elaborated in a default annotation environment (just as it is\r | |
34 | elaborated in an empty basis). The declaration\r | |
35 | <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>\r | |
36 | merges the annotation <em>ann</em> with the "current" annotation environment\r | |
37 | for the elaboration of <em>basdec</em>. To allow for future expansion,\r | |
38 | <span class="monospaced">"</span><em>ann</em><span class="monospaced">"</span> is lexed as a single SML string constant. To\r | |
39 | conveniently specify multiple annotations, the following derived form\r | |
40 | is provided:</p></div>\r | |
41 | <div class="sidebarblock">\r | |
42 | <div class="content">\r | |
43 | <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>\r | |
44 | ⇒\r | |
45 | <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>\r | |
46 | </div></div>\r | |
47 | <div class="paragraph"><p>Here are the available annotations. In the explanation below, for\r | |
48 | annotations that take an argument, the first value listed is the\r | |
49 | default.</p></div>\r | |
50 | <div class="ulist"><ul>\r | |
51 | <li>\r | |
52 | <p>\r | |
53 | <span class="monospaced">allowFFI {false|true}</span>\r | |
54 | </p>\r | |
55 | <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>\r | |
56 | expressions to appear in source files. See\r | |
57 | <a href="ForeignFunctionInterface">ForeignFunctionInterface</a>.</p></div>\r | |
58 | </li>\r | |
59 | <li>\r | |
60 | <p>\r | |
61 | <span class="monospaced">allowSuccessorML {false|true}</span>\r | |
62 | </p>\r | |
63 | <div class="openblock">\r | |
64 | <div class="content">\r | |
65 | <div class="paragraph"><p>Allow or disallow all of the <a href="SuccessorML">SuccessorML</a> features. This is a\r | |
66 | proxy for all of the following annotations.</p></div>\r | |
67 | <div class="ulist"><ul>\r | |
68 | <li>\r | |
69 | <p>\r | |
70 | <span class="monospaced">allowDoDecls {false|true}</span>\r | |
71 | </p>\r | |
72 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow a <span class="monospaced">do <em>exp</em></span> declaration form.</p></div>\r | |
73 | </li>\r | |
74 | <li>\r | |
75 | <p>\r | |
76 | <span class="monospaced">allowExtendedConsts {false|true}</span>\r | |
77 | </p>\r | |
78 | <div class="openblock">\r | |
79 | <div class="content">\r | |
80 | <div class="paragraph"><p>Allow or disallow all of the extended constants features. This is a\r | |
81 | proxy for all of the following annotations.</p></div>\r | |
82 | <div class="ulist"><ul>\r | |
83 | <li>\r | |
84 | <p>\r | |
85 | <span class="monospaced">allowExtendedNumConsts {false|true}</span>\r | |
86 | </p>\r | |
87 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow extended numeric constants.</p></div>\r | |
88 | </li>\r | |
89 | <li>\r | |
90 | <p>\r | |
91 | <span class="monospaced">allowExtendedTextConsts {false|true}</span>\r | |
92 | </p>\r | |
93 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow extended text constants.</p></div>\r | |
94 | </li>\r | |
95 | </ul></div>\r | |
96 | </div></div>\r | |
97 | </li>\r | |
98 | <li>\r | |
99 | <p>\r | |
100 | <span class="monospaced">allowLineComments {false|true}</span>\r | |
101 | </p>\r | |
102 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow line comments beginning with the token <span class="monospaced">(*)</span>.</p></div>\r | |
103 | </li>\r | |
104 | <li>\r | |
105 | <p>\r | |
106 | <span class="monospaced">allowOptBar {false|true}</span>\r | |
107 | </p>\r | |
108 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow a bar to appear before the first match rule of a\r | |
109 | <span class="monospaced">case</span>, <span class="monospaced">fn</span>, or <span class="monospaced">handle</span> expression, allow a bar to appear before the\r | |
110 | first function-value binding of a <span class="monospaced">fun</span> declaration, and allow a bar\r | |
111 | to appear before the first constructor binding or description of a\r | |
112 | <span class="monospaced">datatype</span> declaration or specification.</p></div>\r | |
113 | </li>\r | |
114 | <li>\r | |
115 | <p>\r | |
116 | <span class="monospaced">allowOptSemicolon {false|true}</span>\r | |
117 | </p>\r | |
118 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allows a semicolon to appear after the last expression in a\r | |
119 | sequence expression or <span class="monospaced">let</span> body.</p></div>\r | |
120 | </li>\r | |
121 | <li>\r | |
122 | <p>\r | |
123 | <span class="monospaced">allowOrPats {false|true}</span>\r | |
124 | </p>\r | |
125 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allows disjunctive (a.k.a., "or") patterns of the form\r | |
126 | <span class="monospaced"><em>pat</em> | <em>pat</em></span>.</p></div>\r | |
127 | </li>\r | |
128 | <li>\r | |
129 | <p>\r | |
130 | <span class="monospaced">allowRecordPunExps {false|true}</span>\r | |
131 | </p>\r | |
132 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allows record punning expressions.</p></div>\r | |
133 | </li>\r | |
134 | <li>\r | |
135 | <p>\r | |
136 | <span class="monospaced">allowSigWithtype {false|true}</span>\r | |
137 | </p>\r | |
138 | <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\r | |
139 | signature.</p></div>\r | |
140 | </li>\r | |
141 | <li>\r | |
142 | <p>\r | |
143 | <span class="monospaced">allowVectorExpsAndPats {false|true}</span>\r | |
144 | </p>\r | |
145 | <div class="openblock">\r | |
146 | <div class="content">\r | |
147 | <div class="paragraph"><p>Allow or disallow vector expressions and vector patterns. This is a\r | |
148 | proxy for all of the following annotations.</p></div>\r | |
149 | <div class="ulist"><ul>\r | |
150 | <li>\r | |
151 | <p>\r | |
152 | <span class="monospaced">allowVectorExps {false|true}</span>\r | |
153 | </p>\r | |
154 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow vector expressions.</p></div>\r | |
155 | </li>\r | |
156 | <li>\r | |
157 | <p>\r | |
158 | <span class="monospaced">allowVectorPats {false|true}</span>\r | |
159 | </p>\r | |
160 | <div class="paragraph"><p>If <span class="monospaced">true</span>, allow vector patterns.</p></div>\r | |
161 | </li>\r | |
162 | </ul></div>\r | |
163 | </div></div>\r | |
164 | </li>\r | |
165 | </ul></div>\r | |
166 | </div></div>\r | |
167 | </li>\r | |
168 | <li>\r | |
169 | <p>\r | |
170 | <span class="monospaced">forceUsed</span>\r | |
171 | </p>\r | |
172 | <div class="paragraph"><p>Force all identifiers in the basis denoted by the body of the <span class="monospaced">ann</span> to\r | |
173 | be considered used; use in conjunction with <span class="monospaced">warnUnused true</span>.</p></div>\r | |
174 | </li>\r | |
175 | <li>\r | |
176 | <p>\r | |
177 | <span class="monospaced">nonexhaustiveBind {warn|error|ignore}</span>\r | |
178 | </p>\r | |
179 | <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>\r | |
180 | declarations (i.e., pattern-match failures that raise the <span class="monospaced">Bind</span>\r | |
181 | exception). An error will abort a compile, while a warning will not.</p></div>\r | |
182 | </li>\r | |
183 | <li>\r | |
184 | <p>\r | |
185 | <span class="monospaced">nonexhaustiveExnBind {default|ignore}</span>\r | |
186 | </p>\r | |
187 | <div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches\r | |
188 | in <span class="monospaced">val</span> declarations that arise solely from unmatched exceptions.\r | |
189 | If <span class="monospaced">default</span>, follow the behavior of <span class="monospaced">nonexhaustiveBind</span>.</p></div>\r | |
190 | </li>\r | |
191 | <li>\r | |
192 | <p>\r | |
193 | <span class="monospaced">nonexhaustiveExnMatch {default|ignore}</span>\r | |
194 | </p>\r | |
195 | <div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches\r | |
196 | in <span class="monospaced">fn</span> expressions, <span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations that\r | |
197 | arise solely from unmatched exceptions. If <span class="monospaced">default</span>, follow the\r | |
198 | behavior of <span class="monospaced">nonexhaustiveMatch</span>.</p></div>\r | |
199 | </li>\r | |
200 | <li>\r | |
201 | <p>\r | |
202 | <span class="monospaced">nonexhaustiveExnRaise {ignore|default}</span>\r | |
203 | </p>\r | |
204 | <div class="paragraph"><p>If <span class="monospaced">ignore</span>, suppress errors and warnings about nonexhaustive matches\r | |
205 | in <span class="monospaced">handle</span> expressions that arise solely from unmatched exceptions.\r | |
206 | If <span class="monospaced">default</span>, follow the behavior of <span class="monospaced">nonexhaustiveRaise</span>.</p></div>\r | |
207 | </li>\r | |
208 | <li>\r | |
209 | <p>\r | |
210 | <span class="monospaced">nonexhaustiveMatch {warn|error|ignore}</span>\r | |
211 | </p>\r | |
212 | <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>\r | |
213 | expressions, <span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations (i.e.,\r | |
214 | pattern-match failures that raise the <span class="monospaced">Match</span> exception). An error\r | |
215 | will abort a compile, while a warning will not.</p></div>\r | |
216 | </li>\r | |
217 | <li>\r | |
218 | <p>\r | |
219 | <span class="monospaced">nonexhaustiveRaise {ignore|warn|error}</span>\r | |
220 | </p>\r | |
221 | <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>\r | |
222 | expressions (i.e., pattern-match failures that implicitly (re)raise\r | |
223 | the unmatched exception). An error will abort a compile, while a\r | |
224 | warning will not.</p></div>\r | |
225 | </li>\r | |
226 | <li>\r | |
227 | <p>\r | |
228 | <span class="monospaced">redundantBind {warn|error|ignore}</span>\r | |
229 | </p>\r | |
230 | <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.\r | |
231 | An error will abort a compile, while a warning will not.</p></div>\r | |
232 | </li>\r | |
233 | <li>\r | |
234 | <p>\r | |
235 | <span class="monospaced">redundantMatch {warn|error|ignore}</span>\r | |
236 | </p>\r | |
237 | <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,\r | |
238 | <span class="monospaced">case</span> expressions, and <span class="monospaced">fun</span> declarations. An error will abort a\r | |
239 | compile, while a warning will not.</p></div>\r | |
240 | </li>\r | |
241 | <li>\r | |
242 | <p>\r | |
243 | <span class="monospaced">redundantRaise {warn|error|ignore}</span>\r | |
244 | </p>\r | |
245 | <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>\r | |
246 | expressions. An error will abort a compile, while a warning will not.</p></div>\r | |
247 | </li>\r | |
248 | <li>\r | |
249 | <p>\r | |
250 | <span class="monospaced">resolveScope {strdec|dec|topdec|program}</span>\r | |
251 | </p>\r | |
252 | <div class="paragraph"><p>Used to control the scope at which overload constraints are resolved\r | |
253 | to default types (if not otherwise resolved by type inference) and the\r | |
254 | scope at which unresolved flexible record constraints are reported.</p></div>\r | |
255 | <div class="paragraph"><p>The syntactic-class argument means to perform resolution checks at the\r | |
256 | smallest enclosing syntactic form of the given class. The default\r | |
257 | behavior is to resolve at the smallest enclosing <em>strdec</em> (which is\r | |
258 | equivalent to the largest enclosing <em>dec</em>). Other useful behaviors\r | |
259 | are to resolve at the smallest enclosing <em>topdec</em> (which is equivalent\r | |
260 | to the largest enclosing <em>strdec</em>) and at the smallest enclosing\r | |
261 | <em>program</em> (which corresponds to a single <span class="monospaced">.sml</span> file and does not\r | |
262 | correspond to the whole <span class="monospaced">.mlb</span> program).</p></div>\r | |
263 | </li>\r | |
264 | <li>\r | |
265 | <p>\r | |
266 | <span class="monospaced">sequenceNonUnit {ignore|error|warn}</span>\r | |
267 | </p>\r | |
268 | <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\r | |
269 | sequence expression <span class="monospaced">(e1; e2)</span>. This can be helpful in detecting\r | |
270 | curried applications that are mistakenly not fully applied. To\r | |
271 | silence spurious messages, you can use <span class="monospaced">ignore e1</span>.</p></div>\r | |
272 | </li>\r | |
273 | <li>\r | |
274 | <p>\r | |
275 | <span class="monospaced">valrecConstr {warn|error|ignore}</span>\r | |
276 | </p>\r | |
277 | <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\r | |
278 | redefines an identifier that previously had constructor status. An\r | |
279 | error will abort a compile, while a warning will not.</p></div>\r | |
280 | </li>\r | |
281 | <li>\r | |
282 | <p>\r | |
283 | <span class="monospaced">warnUnused {false|true}</span>\r | |
284 | </p>\r | |
285 | <div class="paragraph"><p>Report unused identifiers.</p></div>\r | |
286 | </li>\r | |
287 | </ul></div>\r | |
288 | </div>\r | |
289 | </div>\r | |
290 | <div class="sect1">\r | |
291 | <h2 id="_next_steps">Next Steps</h2>\r | |
292 | <div class="sectionbody">\r | |
293 | <div class="ulist"><ul>\r | |
294 | <li>\r | |
295 | <p>\r | |
296 | <a href="MLBasisAnnotationExamples">MLBasisAnnotationExamples</a>\r | |
297 | </p>\r | |
298 | </li>\r | |
299 | <li>\r | |
300 | <p>\r | |
301 | <a href="WarnUnusedAnomalies">WarnUnusedAnomalies</a>\r | |
302 | </p>\r | |
303 | </li>\r | |
304 | </ul></div>\r | |
305 | </div>\r | |
306 | </div>\r | |
307 | </div>\r | |
308 | <div id="footnotes"><hr></div>\r | |
309 | <div id="footer">\r | |
310 | <div id="footer-text">\r | |
311 | </div>\r | |
312 | <div id="footer-badges">\r | |
313 | </div>\r | |
314 | </div>\r | |
315 | </body>\r | |
316 | </html>\r |