another feature request

Stephen Weeks MLton@sourcelight.com
Wed, 19 Sep 2001 14:56:11 -0700


> > I don't know if this is a plausible thing to ask mlton for (depends on your
> > implementation model), but is there a way to do a stack trace for an uncaught
> > exception?  (What in NJ you get from SMLofNJ.exnHistory)
> 
> Right now, upon raising an exception, control jumps right to the handler,
> skipping over any intervening frames.  It doesn't seem impossible to
> extract the stack info, but the best we might be able to do would be to
> produce the list of return continuations on the stack.

My understanding of SMLofNJ.exnHistory is that it only gives the intervening
handlers on the stack, not every stack frame.  Given this, I think it would be
fairly easy to modify MLton's front/middle end to add an extra component to
exceptions (a string list ref) and to change the translation of handle
expressions to cons an appropriate string onto the list ref.  My guess is it's
only an afternoon's worth of work.