logoalt Hacker News

throw1618033911/11/20241 replyview on HN

I'm a novice OCaml user, but AFAIK here's how it works.

int is pointer-sized minus one bit, e.g. 31 on 32-bit, 63 on 64-bit

nativeint is pointer-sized, but boxed.

float is 64-bit and boxed.

There's limited support for different number sizes or specifying signedness.


Replies

MrMcCall11/12/2024

Thanks for your kind reply. In my occasional explorations over the years, that, too, is basically the gist of what I've gathered.

F#, being based upon the .NET compiler and runtime, allows specific targeting of both int size and signedness. I'm surprised that OCaml doesn't also allow that, seeing as its compiler has a long pedigree with respect to both programming contests and real-world hardcore software systems (such as trading desk software). I remember first learning of it around two decades ago as a team used it to win the ICFP contest. I guess that such specificity is just outside of the concerns of the OCaml folks.