Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInt polyfill? #381

Closed
xtuc opened this issue Feb 20, 2018 · 4 comments
Closed

BigInt polyfill? #381

xtuc opened this issue Feb 20, 2018 · 4 comments

Comments

@xtuc
Copy link

xtuc commented Feb 20, 2018

The BigInt proposal is currently in Stage 3, see https://github.com/tc39/proposal-bigint.

We could use it in Babel babel/babel#6015.

@zloirock
Copy link
Owner

zloirock commented Feb 21, 2018

The problem here - BigInt is mainly about internal abstract JS operations, not built-it. Full BigInt built-it API is:

class BigInt {
  constructor(value): bigint;
  static asUintN(bits, bigint): bigint;
  static asIntN(bits, bigint) : bigint;
  toString(radix): string;
  toLocaleString(radix): string;
  valueOf(): bigint;
  @@toStringTag: 'BigInt';
}

Also required extensions of some existent features.

So, Babel can interact with BigInt built-in only through BigInt constructor and toString method -> Babel should implement all abstract operations in helpers instead of calling BigInt methods like in PR, otherwise, you will not be able to interact with native BigInt. Wrapping almost all operators makes this transform unusable for real projects. So I'm confused.

After some days I'll merge v3 branch to master branch, after that feel free add a PR with BigInt polyfill - let's explore what we can do.

@NN---
Copy link

NN--- commented Nov 14, 2018

https://github.com/GoogleChromeLabs/jsbi

@zloirock
Copy link
Owner

(Just a note: JSBI is not a polyfill, it's like to say that regenerator is a polyfill for generators and with the current core-js approach it can't be integrated to core-js.)

@zloirock
Copy link
Owner

I think that it's better to close this issue, I'll add a link to it to the README. If someone has any thoughts about it - write it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants