Skip to content

RFC: Introducing the Bigint #6525

Closed
Closed
@mununki

Description

@mununki

Propose the Bigint in JS as a built-in type.
mdn: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/BigInt

Background

BigInt is a new primitive that provides a way to represent whole numbers larger than 2^53, which is the largest number Javascript can reliably represent with the Number primitive. It is not introduced yet to ReScript yet.

Proposal

Literal

nativeint is actually locked in ReScript. I'd like to suggest using the 'n' suffix for the bigint literal.

1n

Operators

Basically mostly same to the integer operators.

// arithmetic
1n + 1n
1n - 1n
1n * 1n
1n / 1n
2n ** 54n

// neg
-1n

// comparisons
2n > 1n
1n < 2n
1n >= 1n
1n <= 1n
1n == 1n
1n === 1n
1n != 1n
1n !== 1n

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions