On 05/01/12 20:03, 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 ..
There is also the a similar question about what happens when processing SML scripts on stdIn, e.g. for
echo "fun f () : unit = raise Domain; f ();" | poly
we still get a successful exit value.
On many occasions when writing make files I would have found it useful to have an exception raised above, to stop processing on an error. I have always simply wrapped with something that prints out the exception and explicitly sets an exit status via OS.Process.exit. (For my make files, the f is PolyML.use.)
Phil