Re: exnMessage returns text without Message

Phil Clayton <[email protected]> Tue, 16 Aug 2016 21:55:49 +0100
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <[email protected]>
The Basis Library specification
http://sml-family.org/Basis/general.html#SIG:GENERAL.exnMessage:VAL
says that an implementation can choose whether "exnMessage ex" includes 
more than just "exnName ex", so I think MLton is technically compliant. 
However, you can add your own exception printers using 
MLton.Exn.addExnMessager - see
http://mlton.org/MLtonExn

For example, adding the following should give the effect you want:

val () =
   MLton.Exn.addExnMessager
     (fn Foo s => SOME ("Foo \"" ^ s ^ "\"") | _ => NONE)

Phil

On 16/08/16 15:24, Kostirya wrote:
> Hello.
> Probably, there is a bug: exMessage returns only exnName without Message.
>
>> cat foo_exc.sml
> exception Foo of string
> fun foo () = raise Foo "foo msg"
> val _ = foo () handle exc => print ("Raised an exception: " ^ exnMessage
> exc ^ ".\n")
>
> I expect to get:
> Raised an exception: Foo "foo msg".
>
> By I got:
>
>> mlton foo_exc.sml && ./foo_exc
> Raised an exception: Foo.
>
>> mlton
> MLton 20130715 (built Sun May  8 19:16:42 UTC 2016 on bsd)
>
> And last git version of mlton have this error.
>
> Best. Nick.
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> MLton-user mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-user
>


------------------------------------------------------------------------------