[MLton] sequenceUnit vs warnSequenceUnit

Stephen Weeks MLton@mlton.org
Wed, 27 Jul 2005 12:43:23 -0700

> Am I the only one who finds the sequenceUnit annotation a bit
> "strong". 

It hadn't occurred to me before, but now that you mention it ...

> It is not required by the Definition

The default value for the annotation does follow the Definition, and
the point of many of our annotations is to explicitly deviate from the
Definition.  The Definition doesn't suggest one way or the other
(error vs warning) in this regard, since it requires silence.

> I also think that a warning (rather than an error) would be more
> consistent with the "spirit of the Definition", which doesn't
> require errors for unused identifiers nor for non-exhaustive or
> redundant matches.

This seems reasonable.  Although I can imagine cases where one wants
the error.  Hmm.  I wonder if we should go to a tri-valued annotation:
{error|ignore|warn}.  Then, one could say "sequenceUnit error" if one
wants errors and "sequenceUnit warn" if one wants warnings.  The
default would be "sequenceUnit ignore".  With this approach, the names
of warnMatch and warnUnused should probably be changed.  Further, it
may make sense at this point to split warnMatch into two, one for
nonexhaustive matches (which are sometimes not errors) and one for
redundant matches (which usually are).

How about the following?

  nonexhaustiveMatch {warn|error|ignore}
  nonexhaustiveExnMatch {warn|error|ignore}
  redundantMatch {warn|error|ignore}
  sequenceNonUnit {ignore|error|warn}
  unusedIdentifier {ignore|error|warn}