exit status really is only 8 bits

Henry Cejtin henry@sourcelight.com
Sat, 7 Jul 2001 01:26:53 -0500


The fact that OS.Process.exit takes an integer argument is completely insane.
I know that the basis documentation explicitly says that on Posix systems  it
does,  but this is looney.  Even worse, SML/NJ (and sadly MLton) don't detect
the `overflow'.  The exit status of a process holds some bits indicating what
signal the process died as a result of receiving, and, if it did not die from
a signal but used the exit system call, 8 bits  of  status  passed  to  exit.
Note, ONLY 8 bits.

I  would  say that because of this the right thing to use is Word8.word, or a
more abstract type, not int.  If int is used, then  an  exception  should  be
raised if it is not in [0, 256).

I  know  that departing from the int that the basis spec kind-of requires may
be painful, but could we at least raise some kind of exception  in  the  case
that it isn't in this range?