BigInt (Stage 3)
- Dominant language
- No language data
- Stars
- 435
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Champion: @littledan
Spec Repo: https://github.com/tc39/proposal-bigint
Spec Text: https://tc39.github.io/proposal-bigint
Slides (to Stage 3 at May TC39 Meeting): https://docs.google.com/presentation/d/1lrcjQzIFgdUXczeeAzs4GkTXJsRQU21UhtmXef70Qic/edit#slide=id.p
> moved to Stage 3 at July TC39 Meeting https://github.com/tc39/agendas/blob/master/2017/07.md
The syntax has been implemented in Babylon, see https://github.com/babel/babylon/issues/569#issuecomment-306478858 . What remains is a plugin to implement the transform.
- All arithmetic operations and comparisons should be replaced by calls to functions which provide the appropriate behavior depending whether arguments are BigInts or Numbers.
- The transform is slow, so it will really be more of a toy rather than something that should be used in production. For this reason, I'd argue it should be left out of Babel presets.
- Polyfill needed--ideally, this would be a thin wrapper around another BigNum library from npm. There are just a few methods to support. Some functions will have to be a bit different to get close to the right behavior, for example, `valueOf()` should throw a TypeError, so that implicitly casting to Number throws a TypeError, even if it would really return the BigInt. Additionally, the polyfill needs BigInt64Array and DataView operations.
- A good starting point from @amilajack:
> I've done some work on this in a [babel plugin](https://github.com/amilajack/babel-plugin-fail-explicit) that prevents coercion in JS. Here's the [related code](https://github.com/amilajack/babel-plugin-fail-explicit/blob/master/src/index.js#L127-L155) for that
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked TC39 BigInt proposal and the Babylon issue, then inspect the related babel-plugin-fail-explicit code in src/index.js around lines 127-155. Done means a BigInt transform handles arithmetic and comparisons, with the described polyfill support including BigInt64Array and DataView operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100