[MLton] def-use mode suggestions

Tom 7 twm at andrew.cmu.edu
Tue Feb 20 13:32:40 PST 2007

Jake told me about def-use mode and I've started using it. I think it is 
very nice. Rather than using it to browse large static codebases I've been 
using it during active development. A couple of comments:

First, for moderately sized applications it's pretty slow to load the du 
info file. One thing that helps for me is removing all of the links to the 
basis code; although occasionally it might be nice to be able to see the 
definition of ^, it occurs so often in my code that it is overwhelming. In 
my makefile I am grepping out any line with the string "basis", which is 
crude and leaves a bunch of basis uses at the top, but shrinks my du file 
by more than a factor of 10. Perhaps an option to filter out defs and uses 
of the basis library and its code?

Second, I think it is a good idea for mlton to write def-use info even if 
elaboration fails--I think one of the best uses of such information is in 
tracking down type errors. (Even if the information isn't perfect because 
of mlton's error recovery, since the program has changed since last 
compile, we aren't clobbering useful def-use info anyway, so it can't 
really do any harm...) I modified my copy of mlton to do this and it seems 
to work; in main/compile.fun I just moved the call to Env.processDefUse 
into the "pass" for parseAndElaborateMLB so it is run even if there are 
errors. I'm not sure if this is actually correct, though, since I can't 
quite figure out what other effects processDefUse has. With this patch, 
you can even run mlton continuously in the background while you're editing 
code like Eclipse, though I'm not sure that's a good idea. ;)

  - Tom

[ NEW! : http://tom7.org/       ]
[ OLD! : http://fonts.tom7.com/ ]

More information about the MLton mailing list