[MLton] Overflow Exception

Stephen Weeks MLton@mlton.org
Wed, 15 Sep 2004 09:34:22 -0700


> Are you by chance using the SMLNJ-Lib?  In the BitArray implementation,
> 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
> replaced the code by:
>            val maxLen = (8*Word8Array.maxLen)
>                         handle Overflow => Word8Array.maxLen

Another excellent reason why we should distribute (either as part of
our release or as a separate tgz) a version of SMLNJ-Lib ported to
MLton.