vesa.a.j.k at gmail.com
Wed Jun 13 10:18:20 PDT 2007
On 6/13/07, Matthew Fluet <fluet at tti-c.org> wrote:
> Vesa Karvonen wrote:
> > Is there some reason why functionality
> > equivalent to Primitive.TopLevel.setHandler is not exposed?
> I don't see why not. I don't think it was clear why it would be useful.
> Generally, wrapping a 'main' function with a "handle _ => ..." usually
> accomplishes the same thing.
Unless the evaluation of some top-level declaration (maybe in a
library) raises an exception before the main is entered. So, it can
be useful to make it so that the required special handler is installed
as the first thing when necessary. In some cases outputting to stderr
may not be enough or even work.
> I think the patch looks fine. There is one oddity --
> MLton.Exn.topLevelHandler is equivalent to the default top-level
> handler, rather than the dynamically installed top-level handler. I
> don't think that is bad, but just a curiosity.
> We might rename
> MLton.Exn.topLevelHandler to something that doesn't suggest that it is
> the 'getter' for MLton.Exn.setTopLevelHandler.
More information about the MLton