[MLton] sequenceNonUnit

Matthew Fluet fluet@cs.cornell.edu
Fri, 5 Aug 2005 21:17:38 -0400 (EDT)


> > > Thinking about it briefly, I came up with the following
> > > implementation scheme. During the recursive type inference step, the
> > > inferred type (which may be a variable) of the "ignored expression"
> > > is saved to a list (along with the necessary info to give proper
> > > diagnostics). After type inference, a diagnostic would be given for
> > > each non-unit type in the list. This way the diagnostic given for
> > > the latentError example above, and other similar cases, would
> > > (properly) point to the "ignored expression".
> > >
> > > Would this work and capture the intention of sequenceNonUnit?
> > 
> > Yes.  It looks good.
> 
> I did a simple implementation of this, and I think it works fairly well.  
> However, it does print an error/warning for sequence expressions with 
> non-unit types that are later constrained by a signature to be unit.

The implementation also suffers from the fact that, since a warning does 
not abort the compilation, a warning in a functor body is replicated at 
each functor instantiation (with no distinguishing feature of the warning 
message).