rescript-core icon indicating copy to clipboard operation
rescript-core copied to clipboard

Difference in limit for Int in Int.fromString and Belt.Int.fromString

Open Poornashree08 opened this issue 1 year ago • 1 comments

Can see that there was no specific min and max limit check in Belt.Int.fromString but in Rescript core Int.fromString maybeInt > 2147483647 || maybeInt < -2147483648 check is added. Why exactly this limitation was added as this is affecting previous behaviour Screenshot 2024-01-25 at 6 55 17 PM ?

Poornashree08 avatar Jan 25 '24 13:01 Poornashree08

Switching from Belt.Int.toString() to Int.toString() is not seamless here since Belt did not check for these bounds.

seekshiva avatar Feb 14 '24 03:02 seekshiva

Int in ReScript is meant to be 32 bits, so Belt.Int.fromString is unsafe compared to RescriptCore.Int.fromString because it doesn't check for that. If something has to be corrected, it is in Belt. Don't hesitate to open a PR for this in rescript main repo.

tsnobip avatar Mar 07 '25 11:03 tsnobip