[MLton] Overflow Exception

Raymond Racine ray@hcoop.net
Tue, 14 Sep 2004 22:45:36 -0400


On Tue, 2004-09-14 at 22:29, Matthew Fluet wrote:

> Are you by chance using the SMLNJ-Lib?  In the BitArray implementation,
Why, yes, I am.
> there is a maxLen computation given by:
>            val maxLen = 8*Word8Array.maxLen
> This is fine in SML/NJ where Word8Array.maxLen is 16777215, but in MLton,
> Word8Array.maxLen = valOf(Int.maxInt), so the computation overflows. I
And so it did.

> replaced the code by:
>            val maxLen = (8*Word8Array.maxLen)
>                         handle Overflow => Word8Array.maxLen

All better now, thanks.