[MLton] Compiler warnings
Sun, 4 Jan 2004 15:39:29 -0800
> GCC has a -Wall option for turning on a bunch of options all about
> warnings. My current idea is something around mimicking -Wunused
> which should report values defined in the code but never used in the
I think something like this would be nice.
> Maybe the dead-code eliminator can do this job neatly?
The right place to do this is in the elaborator, which already has the
infrastructure in place to implement -show-basis-used. If you look in
elaborate/elaborate-env.fun, you'll see the isUsed bool ref that keeps
track of whether or not environment entries are used. With some
appropriate code running in the scope function to look at values that
are disappearing from scope, you should be able to warn about unused
I agree with Henry that you will probably get spurious warnings with
libraries. But at least for locally declared variables inside lets or
function parameters, the warnings should be OK. I'd be interested to
find out how many unused variables there are in MLton.