1 of 8

Numeric Separators in Legacy NonOctal

Or: Separator in NonOctalDecimalIntegerLiteral fractional / exponent parts?

TC39 July, 2020� https://github.com/tc39/ecma262/issues/2090

2 of 8

Numeric Separators are forbidden in Legacy NonOctals

  • NonOctals === NonOctalDecimalIntegerLiteral
  • 08; 01238; // valid in Non Strict Mode
  • 08_1 // SyntaxError
  • 0_8 // SyntaxError

3 of 8

No prohibition of separators in fractional or exponential parts

  • 1.111_111
  • 1e1_0

4 of 8

Annex B

5 of 8

Valid code

  • 08.1_1
  • 08e1_0

6 of 8

Engines

  • 08.1_1; // Valid 8.11 in JSC, SpiderMonkey, and V8
  • 08e1_0 // Valid 8e10 (80000000000) in JSC, SpiderMonkey, and V8
  • Both SyntaxError in Moddable XS, engine262, ...

7 of 8

Problem

  • I don't see a fair motivation to disallow numeric separators in the fractional or exponential parts of Legacy NonOctals.
  • A change would probably require a non-small extension of DecimalLiteral grammar into Annex B, rather than just DecimalIntegerLiteral.
  • A better broad solution would be disallowing exponential parts from NonOctals, but not tackled in this issue.

8 of 8

Questions?