[MLton] def-use mode suggestions

Vesa Karvonen vesa.karvonen at cs.helsinki.fi
Tue Feb 20 15:05:00 PST 2007

Quoting Tom 7 <twm at andrew.cmu.edu>:
> 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:

Thanks!  I also use the mode for active development.

> First, for moderately sized applications it's pretty slow to load the du 
> info file. [...]

Do you mean to load or to parse?  The latest def-use mode can query
information from a def-use file loaded into a buffer without having to
perform complete parsing:


Complete parsing may take a lot of time (minutes even).  Just loading
the def-use data should only take a couple of seconds.  For reference,
on my laptop it takes less than 2 seconds to load the def-use file
(> 20 MB from the cache) produced by compiling the MLton compiler

> Second, I think it is a good idea for mlton to write def-use info even if 
> elaboration fails [...] I modified my copy of mlton to do this and it seems 
> to work [...] I'm not sure if this is actually correct, though, since I can't 
> quite figure out what other effects processDefUse has.

I also think that it would make sense to write def-use info even if
elaboration fails.  Could you send your patch to the list.  Someone
could then take a look at it.  I'm afraid I'm not that intimitely
familiar with everything that processDefUse does either.

> [...] 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. ;)

BTW, at work I currently use a setup where a separate machine just
keeps compiling

  while true; do if make ... ; then echo -n . ; sleep 1 ; else read -sn 1 -p "<ENTER>" ; fi ; done

the project.  Works quite nicely.  Most of the time the new def-use
info just gets reloaded automatically.  I've been thinking about writing
some minimal Emacs support for working like this (e.g automatically
rerun compile command after some buffers have been saved, get output
(errors) from the compiler into a buffer, ability to jump to errors).

-Vesa Karvonen

More information about the MLton mailing list