1 of 10

BigInt status update

Daniel Ehrenberg�Igalia

TC39 November 2017

In partnership with Bloomberg

2 of 10

Spec changes

3 of 10

Spec changes since last time

  • Bug fixes:
  • Add BigInt.prototype[Symbol.toStringTag]� (Georg Neis)
  • Add endianness argument to DataView methods� (Robin Templeton)
  • Commit atomics integration patch� (Lars Hansen)
  • Keep allowing BigInts as property keys
  • Various editorial/typo fixes� (Andre Bargull, Robin, Caio Lima, Rick Waldron, etc)

4 of 10

Spec questions

5 of 10

Property key obj[1n] = 5;

  • Discussed last time
  • Some implementers continued to express concerns afterwards
  • Others preferred continuing to allow it
  • Conclusion: Continue to allow BigInt as a property key

6 of 10

Shift/power by Numbers? (bug)

  • Should we permit 1n << 2, 1n ** 5 ?
  • Implementation-wise: fairly neutral
  • In practice, if out of Number range, operations’ results will not fit in memory, so the BigInt size is not useful

(previously discussed, but re-raised by� V8 (Jakob Kummerow) and JSC (Michael Saboff))

7 of 10

Negative shifts (bug)

  • Other languages don’t permit
    • 1n << -3n
  • Throw a RangeError?�(Raised by Ben Smith)

8 of 10

BigInt.parseInt strictness (PR)

  • Previously, BigInt.parseInt tried to stay close to parseInt
  • Core use case: passing a radix when parsing an integer
  • Now, clean it up?
    • RangeError on bad radix (@cxielarko)
    • Throw a SyntaxError with "0x" prefixes (@ajklein)
    • Throw a SyntaxError on trailing garbage
  • Or, just drop BigInt.parseInt (implement in JS library)?

9 of 10

Implementation status

10 of 10

Implementation status

  • Nearly complete test262 tests�(test plan, tested by Josh Wolfe and Robin Templeton)
  • SpiderMonkey implementation (bug; by Robin Templeton)
  • V8 implementation nearing feature completeness�(bug; implemented by Georg Neis and Jakob Kummerow)
  • JSC implementation starting�(bug; implementation from Caio Lima and Robin Morisset)