Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0a961c

Browse files
committedMay 18, 2025
use footnotes
1 parent e3d8cec commit c0a961c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎text/0001-int.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Let `min_value` be $-2^{31}$ and `max_value` be $2^{31}-1$
4747

4848
The [`ToInt32`] behavior follows the definition in ECMA-262 as is. ReScript compiler uses `bitwiseOR(number, 0)` in action. This is what appears in the output as `number | 0`, which truncates all special numbers defined in IEEE-754.
4949

50-
The `fromNumber` shouldn't be directly exposed to the users. Applying the [`ToInt32`] operation to special numeric values, such as `Infinity`, can lead to subtle bugs. See related issues [a](https://github.com/rescript-lang/rescript/issues/6038), [b](https://github.com/rescript-lang/rescript/issues/6736), [c](https://github.com/rescript-lang/rescript/issues/6737).
50+
The `fromNumber` shouldn't be directly exposed to the users. Applying the [`ToInt32`] operation to special numeric values, such as `Infinity`, can lead to subtle bugs[^1][^2][^3].
5151

5252
Instead, public APIs should wrap it and perform bounds-checking, if necessary, either emit errors (explained further in the ["API Consideration"](#api-consideration) section below) or notify the user via compiler warning.
5353

@@ -207,3 +207,6 @@ However, this will not happen in the near future. It won't occur until we are co
207207
Guaranteeing the use of int32 types may offer additional advantages in the future when targeting WebAssembly or alternative native backends.
208208

209209
[`ToInt32`]: https://262.ecma-international.org/#sec-toint32
210+
[^1]: https://github.com/rescript-lang/rescript/issues/6038
211+
[^2]: https://github.com/rescript-lang/rescript/issues/6736
212+
[^3]: https://github.com/rescript-lang/rescript/issues/6737

0 commit comments

Comments
 (0)
Please sign in to comment.