On Thu, 5 Jan 2012, Ian Zimmerman wrote:
[17]matica:~$ poly
Poly/ML 5.4.1 Release
fun main () = raise Domain ;
val main = fn: unit -> 'a
PolyML.export ("foo", main);
val it = (): unit
[19]matica:~$ cc -o foo foo.o -lpolymain -lpolyml
[20]matica:~$ ./foo
[21]matica:~$ echo $?
0
I find this quite surprising, am I the only one?
I know that I can easily work around it by including an exception
catching wrapper in main, but it seems to me that wrapper should be in
libpolymain ..
I am not surprised, maybe because I am used to it for many years, and have
my own wrappers to do the right thing.
What is "right" depends on the situation. In particular there are at
least two main classes of ML exceptions: regular or Interrupt, potentially
further derived things like TimeOut. If Poly/ML would take a certain
default action wrt. process exit, one would have to modify this in the
application anyway. Also note that the same question arises again for ML
threads: a final exception is absorbed, but can be easily treated by a
user-space wrapper. (The main function above is probably associated with a
certain default ML thread, but David should be able to explain this
better.)
Makarius
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml