[MLton] Long identifiers and def-use data

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Tue, 18 Apr 2006 10:17:23 +0300


Consider the following SML snippet:

structure S = struct val v = () end
val () =
S.v

For the above snippet, MLton produces the following def-use data:

structure S def-use.sml 1.11
    def-use.sml 3.1 
variable v def-use.sml 1.26
    def-use.sml 3.1 

As you can see, the same column is reported for the use of the structure S
and the variable v.  This is not unreasonable, because the expression S.v
is a long identifier, but it also wouldn't be unreasonable to report a
more precise column for the use of the variable v, essentially treating
long identifiers as compound expressions.  For the above snippet, the
following def-use data would be produced:

structure S def-use.sml 1.11
    def-use.sml 3.1 
variable v def-use.sml 1.26
    def-use.sml 3.3 

During the holiday I worked on an Emacs module to automatically highlight
definitions and uses, while browsing SML code.  The module will also support
some other functionality, such as "jump-to-def" and "jump-to-next-ref".  It
still needs some work, but the highlighting part works under XEmacs (I will
also port it to GNU Emacs).  I noticed this issue while browsing some of my
code.

I haven't yet had time to look at the MLton code that produces the def-use
data.  Is there some fundamental reason to treat long identifiers as
atomic expressions as they are treated currently?

-Vesa Karvonen