[MLton-user] Linking (?) 'print' means I can only run from the mingw command line

Matthew Fluet fluet at tti-c.org
Mon Sep 15 10:28:58 PDT 2008


On Mon, 15 Sep 2008, Vesa Karvonen wrote:
> On Mon, Sep 15, 2008 at 2:30 PM, Wesley W. Terpstra <wesley at terpstra.ca> wrote:
> [...]
>> I tend towards option #2. stdin&out can come from openIn/Out "NUL". However,
>> if stderr is missing one loses exception information. Perhaps it could
>> create a popup window. A TextPrimIO.writer that creates a window and adds
>> text on write* calls shouldn't be that hard to implement.
>
> BTW, this issue was also underlying the thread starting here:
>
>  http://mlton.org/pipermail/mlton/2007-June/029811.html
>
> Basically, some code was failing and (IIRC) then the program went into
> an infinite memory hogging loop, because the default handler couldn't
> write to stderr.
>
> With the current MLton one can set the top-level handler in SML and do
> whatever one wants there.

But, this doesn't help with exceptions raised during the evaluation of the 
Basis Library, since they occur before any user-code that installs a 
different top-level handler.

> A default behavior where (at least) something gets displayed (in a
> message box), could be nice to have.  I don't know how intrusive the
> change (to handle the "write* calls") would be.

Actually, even the default top-level handler for a program doesn't go 
through TextIO.  See <src>/basis-library/mlton/exn.sml.  This is 
purposeful, so that if a program doesn't otherwise use TextIO, the 
(necessary) top-level handler doesn't pull it in.




More information about the MLton-user mailing list