[MLton] nonexhaustiveMatch, redundantMatch and nonexhaustiveExnMatch

Matthew Fluet fluet@cs.cornell.edu
Wed, 3 Aug 2005 20:42:23 -0400 (EDT)


I've committed the patch.

> I introduced a new datatype 
> 
> +      datatype diagnostic =
> +         Error
> +       | Ignore
> +       | Warn
> 
> in control-flags in order to implement the {warn|ignore|error}
> annotations. Although the constructor names start with a capital letter,
> the names used in annotations do not:

That is the correct convention.  I went a little bit futher and put the 
datatype in a Control.Elaborate.Diagnostic structure, which gave a place 
to define the toString and fromString functions.

> The new annotations do not change the "warnMatch" setting. I'm not sure
> whether this is the best way to do it. The code is basically adapted from
> "allowFFI". Probably neither "allowFFI" nor "warnMatch" should have state
> of their own. As with "allowFFI", it is possible to create potentially
> confusing specifications:
> 
>   "warnMatch true"
>   ...
>   "redundantMatch false"
>   "nonexhaustiveMatch false"
> 
> Now warnMatch would still be true. However, things should work as expected
> as long as one only uses either "warnMatch" or "redundantMatch" +
> "nonexhaustiveMatch", but not both.

Right.  I will be adding a fix that eliminates the controls associated 
with the deprecated annotations.