GrammaticalFramework/gf-core

Limitations of mkInt in PGF2

johnjcamilleri opened this issue · 1 comments

I recently came across this:

Prelude> import PGF
Prelude PGF> mkInt 2147483647
ELit (LInt 2147483647)
Prelude PGF> mkInt 2147483648
ELit (LInt 2147483648)
Prelude> import PGF2
Prelude PGF2> mkInt 2147483647
2147483647
Prelude PGF2> mkInt 2147483648
-2147483648

In short, the Haskell PGF runtime supports infinite integers whereas when using PGF2, I get an overflow beyond a certain value. I can guess at the underlying reason for this, which maybe is not easily fixable in the C runtime, however it is a limitation that should at least be documented in the Haskell bindings.

From Krasimir:

Support for long integers in the C runtime is possible via libgmp. The problem is that although both Haskell and Python support long integers, they do not provide FFI with these. Java, C# and many other languages simply do not support them at all.