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 (Stage 3) #2

Open
littledan opened this issue Jun 29, 2017 · 7 comments
Open

BigInt (Stage 3) #2

littledan opened this issue Jun 29, 2017 · 7 comments

Comments

@littledan
Copy link

littledan commented Jun 29, 2017

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 babel/babylon#569 (comment) . 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 that prevents coercion in JS. Here's the related code for that

@wdhorton
Copy link

Now that the syntax has been implemented, I can go ahead and work on the transform too

@littledan
Copy link
Author

How's this implementation coming along? Anything I could help with?

BTW there are some tests to start with in test262 here from my colleague @cxielarko at Igalia, but there's a lot of room for additional tests.

@hzoo hzoo changed the title Implement the BigInt proposal BigInt (Stage 2) Jul 17, 2017
@wdhorton
Copy link

@littledan apologies for the delay on this, haven't had as much time to work on it as I expected. i'm planning on digging in this weekend and hopefully getting through a lot of it, and i just put up a WIP PR with the transform for adding BigInts, with a few questions babel/babel#6015

@hzoo hzoo changed the title BigInt (Stage 2) BigInt (Stage 3) Jul 27, 2017
@hzoo hzoo mentioned this issue Jul 28, 2017
10 tasks
@towc
Copy link

towc commented May 4, 2018

any developments on this? Somewhere you might want help?

@graup
Copy link

graup commented Oct 24, 2018

There's a PR with some progress in babel/babel#6015. I'd also love to see this working, as Chrome has built-in support for bigints now (https://developers.google.com/web/updates/2018/05/bigint), so it would make sense to start writing code with the new syntax.

@littledan
Copy link
Author

Seems like this would be a good project for someone to pick up.

@Bnaya
Copy link

Bnaya commented Nov 9, 2018

FYI: typescript have merged their BigInt support!
microsoft/TypeScript#25886

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

6 participants