David,
The basis library documentation for exception SysErr states:
...but if a SysErr exception has the form SysErr (s, SOME e), then we have errorMsg e = s.
http://www.standardml.org/Basis/os.html
However, it appears that Poly/ML is not always preserving that property because errorMsg e and s are sometimes different strings, for example:
val () = ignore (TextIO.openIn "a non-existent file name") handle e as IO.Io {cause, ...} => ( case cause of OS.SysErr (s, SOME e) => ( print "\n"; app print ["s = "", s, ""\n"]; app print ["errorMsg e = "", OS.errorMsg e, ""\n"] ) | _ => () );
If the Standard is to be followed and one of the messages must be chosen, the string returned by errorMsg e seems to be the useful one as s can be deduced from the structure of the program, at least in this example.
Regards, Phil
Phil, Thanks for pointing that out. I'd completely missed it. I suspect that it was something added after the draft version that I worked from when I did the original implementation. I've fixed it now. When the RTS generates a SysErr exception it uses the errorMsg string if the second argument is SOME e. Regards, David
Phil Clayton wrote:
David,
The basis library documentation for exception SysErr states:
...but if a SysErr exception has the form SysErr (s, SOME e), then we have errorMsg e = s.
http://www.standardml.org/Basis/os.html
However, it appears that Poly/ML is not always preserving that property because errorMsg e and s are sometimes different strings, for example:
val () = ignore (TextIO.openIn "a non-existent file name") handle e as IO.Io {cause, ...} => ( case cause of OS.SysErr (s, SOME e) => ( print "\n"; app print ["s = "", s, ""\n"]; app print ["errorMsg e = "", OS.errorMsg e, ""\n"] ) | _ => () );
If the Standard is to be followed and one of the messages must be chosen, the string returned by errorMsg e seems to be the useful one as s can be deduced from the structure of the program, at least in this example.
Regards, Phil
polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml