[MLton] possible change to annotations
Matthew Fluet
fluet@cs.cornell.edu
Mon, 15 Nov 2004 18:23:03 -0500 (EST)
> Since we already have "local" as a scoping mechanism in MLBs, I was
> wondering if it would be reasonable to eliminate the explicit scoping
> syntax of annotations, replacing
>
> <bdec> ::= ann "..." in <bdec> end
>
> with
>
> <bdec> ::= ann "..."
>
> where the intended meaning is that an annotation applies in the rest
> of its scope, just as, e.g., "val x = ..." declares x to be available
> in the rest of its scope.
This would work fine with the {true,false} annotations. Although, as an
implementation, I would want to change ElaborateEnv to have an explicit
annotation component to handle leaving of scopes. That raises the
question of whether or not opening an MBasis (as with a .mlb or basis id
reference) also adds the annotations into scope. The current
implementation does not.
The forceUsed and ffiStr annotations are a little different. I would
imagine that rather than applying to the environment in place at the end
of their scope, they apply to the environment in place at their
declaration.
> The current syntax is a special case
>
> ann "..." in <bdec> end
> ===> local ann "..." in <bdec> end
As noted above, forceUsed and ffiStr would probably be different in this
regard.