[MLton] -warn-unused true and MLton

Matthew Fluet fluet@cs.cornell.edu
Wed, 18 Feb 2004 08:36:02 -0500 (EST)


> > I've been changing:
> >
> > (f x; ()) ==> ignore (f x)
> >
> > (f x; e) ==> let val _ = f x
> >              in e
> >              end
> >
> > (f x; g y; ()) ==> let val _ = f x
> >                        val _ = g y
> >                    in ()
> >                    end
>
> I was thinking it would be nice to use "val () = ..." instead of "val
> _ = ..." when the return type is unit.  I've long wanted to use that
> idiom, but had avoided it because it caused SML/NJ to give a warning
> about no variables in pattern or something like that.  I just checked
> SML/NJ 110.44 and it no longer gives that warning.  So, I'd be happy
> to start seeing "val () = ...", and plan to try it myself.

Fine .... but in the context of a -sequence-unit error, the whole issue is
that the return type is not unit. ;-)

We could use the following idiom:

(f x; e) ==> let val () = ignore (f x)
             in e
             end

although then I don't see it being much better than

(f x; e) ==> (ignore (f x); e)

and also a little more visually cluttered.