purescript-integers icon indicating copy to clipboard operation
purescript-integers copied to clipboard

Add details on how Int is represented when compiling to Javascript

Open JamieBallingall opened this issue 3 years ago • 1 comments

The documentation for Int in Prim says: "A 32-bit signed integer. See the purescript-integers package for details of how this is accomplished when compiling to JavaScript."

I don't think this package really fulfills that promise at the moment. It would be nice to add some documentation about how that is handled when compiling to Javascript.

In a multi-compiler world maybe this package isn't the right place for that. In that case, perhaps we put the documentation somewhere else but it would still be nice if it existed.

JamieBallingall avatar Jul 12 '22 20:07 JamieBallingall

One part of it is that bitwise operations cause a float 64 to be internally converted to int 32 by JS https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#bitwise_operators

The rest (other than bitwise operators) is also unclear to me, i was wondering about it as well.

flip111 avatar Oct 08 '23 21:10 flip111