ML Basis 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 ann "ann" in basdec end merges the annotation ann with the "current" annotation environment for the elaboration of basdec. To allow for future expansion, "ann" is lexed as a single SML string constant. To conveniently specify multiple annotations, the following derived form is provided:

ann "ann" ("ann" )+ in basdec endann "ann" in ann ("ann")+ in basdec end end

Here are the available annotations. In the explanation below, for annotations that take an argument, the first value listed is the default.

  • allowFFI {false|true}

    If true, allow _address, _export, _import, and _symbol expressions to appear in source files. See ForeignFunctionInterface.

  • forceUsed

    Force all identifiers in the basis denoted by the body of the ann to be considered used; use in conjunction with warnUnused true.

  • nonexhaustiveExnMatch {default|ignore}

    If ignore, suppress errors and warnings about nonexhaustive matches that arise solely from unmatched exceptions. If default, follow the behavior of nonexhaustiveMatch.

  • nonexhaustiveMatch {warn|error|ignore}

    If error or warn, report nonexhaustive matches. An error will abort a compile, while a warning will not.

  • redundantMatch {warn|error|ignore}

    If error or warn, report redundant matches. An error will abort a compile, while a warning will not.

  • resolveScope {strdec|dec|topdec|program}

    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.

    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 strdec (which is equivalent to the largest enclosing dec). Other useful behaviors are to resolve at the smallest enclosing topdec (which is equivalent to the largest enclosing strdec) and at the smallest enclosing program (which corresponds to a single .sml file and does not correspond to the whole .mlb program).

  • sequenceNonUnit {ignore|error|warn}

    If error or warn, report when e1 is not of type unit in the sequence expression (e1; e2). This can be helpful in detecting curried applications that are mistakenly not fully applied. To silence spurious messages, you can use ignore e1.

  • valrecConstr {warn|error|ignore}

    If error or warn, report when a val rec (or fun) declaration redefines an identifier that previously had constructor status. An error will abort a compile, while a warning will not.

  • warnUnused {false|true}

    Report unused identifiers.

Here are the annotations for enabling SuccessorML features. The default value for all of these annotations is false, the SuccessorML features are all disabled by default. For information on the SuccessorML features see SuccessorML.

  • allowDoDecls {false|true}

    If true allows for the usage of do declarations.

  • allowExtendedLiterals {false|true}

    If true allows for the usage of extended literals.

  • allowLineComments {false|true}

    If true allows for the usage of line comments.

  • allowOptBar {false|true}

    If true allows for a pattern bar to optionally be placed before the first match in a case expression.

  • allowOptSemicolon {false|true}

    If true allows for a semicolon to optionally be placed after the last expression in a series.

  • allowOrPats {false|true}

    If true allows for the usage of disjunctive patterns.

  • allowRecPunning {false|true}

    If true allows for the usage record punning.

  • allowSigWithtype {false|true}

    If true allows for the usage the withtype keyword in signatures.

Next Steps