[MLton] Long identifiers and def-use data

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Wed, 19 Apr 2006 02:22:08 +0300


FYI, I just got the highlighting code working in GNU Emacs and XEmacs.
(Apparently the GNU Emacs folks like to create interfaces by basically
copying an existing XEmacs interface and renaming the functions:
s/extent/overlay/g (well, almost).  Luckily XEmacs also provides the
overlay interface.) There are still a few more things to do.

>From the perspective of highlighting definitions and uses, the current
treatment of long identifiers and/or the current form of def-use data
causes two main difficulties:
1. To properly highlight uses, the text at the position reported by MLton
   should be scanned to determine the proper end (and maybe even the
   beginning) of the highlighting overlay.
2. At uses, either explicit or heuristic disambiquation would be needed
   to determine which part of a long identifier the user is really
   referring to.
To allow for multiple uses to coexist at a single source location, the
data structures supporting def-use highlighting also need to be slightly
more complicated (range of hash table would need to be a list of symbols
rather than a symbol).

Although these would not be very difficult to do, I haven't yet done
them, because I'm hoping to solve the problems by changing the generated
def-use data (the generation of which I still need to take a look at).

> On the other hand, I'm kind of in favor of the current behavior, even for
> navigating by use/def in Emacs.  In your example, my mental model is that
> "v" is being used _as a long identifier_ at position 3.1.

How about reporting both the column of the (short) identifier and, when
present, the column of the long identifier?

-Vesa Karvonen