Manuel M T Chakravarty
chak at cse.unsw.edu.au
Wed Sep 11 03:28:09 EDT 2002
Alastair Reid <alastair at reid-consulting-uk.ltd.uk> wrote,
> > Another conflict between the FFI spec and the current library
> > implementation: the spec says
> > "The function bitSize returns 0 for types that don't have a
> > fixed bitsize (e.g. Integer)."
> > whereas the current ghc implementation defines bitSize of Integer as
> > a runtime error.
> I think both are unfortunate - we should just admit that not every
> type has a bitsize and return a Maybe. But that doesn't seem likely
> to happen...
> It isn't clear which is the lesser of the two evils:
> - returning 0 is easy to catch but equally easy to carelessly forget
> - raising an exception is harder to catch but has the huge advantage
> that the failure is close to the broken code.
> (Does NHC support non-deterministic exceptions? Dead easy to add if
> Hugs is silent on the issue because we never implemented Bits Integer.
> I think I prefer the GHC semantics.
Ok, I changed the spec to GHC's semantics.
More information about the FFI