Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Separator in NonOctalDecimalIntegerLiteral fractional / exponent parts? #49

Closed
rkirsling opened this issue Aug 7, 2019 · 5 comments
Closed

Comments

@rkirsling
Copy link
Member

rkirsling commented Aug 7, 2019

@gsathya noticed that the proposed spec currently prohibits 09_1 but allows 09.1_1 and 09e1_1.

Specifically, we have:

DecimalLiteral ::
  DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt
  DecimalIntegerLiteral ExponentPart_opt

DecimalIntegerLiteral ::
  NonOctalDecimalIntegerLiteral

JSC and V8 are adhering to the current text, but is this something we'd like to change stance on?

@gsathya
Copy link
Member

gsathya commented Aug 8, 2019

cc @joshualitt

@anba
Copy link

anba commented Aug 9, 2019

Last time I asked #24 (comment), I was told that that's expected/intended.

@rkirsling
Copy link
Member Author

Thanks @anba. It doesn't look like you were provided any rationale in that thread though, so I would at least like to have that spelled out before closing this.

My guess is that we must not be viewing 09.1_1e1_1 as a singular indivisible legacy literal, but instead are considering 09 as a legacy way of accessing the decimal literal production, at which point the usual fractional and exponent parts are allowed. Is this an accurate statement?

@leobalter
Copy link
Member

I feel like we've missed an opportunity to discuss this.

The 08.1_1 literal is now valid in JSC, SpiderMonkey, and V8. Moddable XS implements Numeric Separators but fails at this very notation with a fun error message, btw: SyntaxError: missing ,.

At this point we have Stage 4 request in the agenda for this month's meeting.

My personal opinion is that we could forbid separators in the fractional/exponential parts, but if I'm allowed, I'd rather take this in a follow up PR or proposal, with specific tests and a better tracking.

The current integrations with the string to number parsings and BigInt notation was a bit harsh and the follow up would be pretty minor if we compare.

The question is, does this follow up works for everyone? We can still add it to the agenda today.

@leobalter
Copy link
Member

At the TC39 Meeting in July 2020 we reached a conclusion this belongs to a broader matter whether NonOctals should have fractional or exponential parts disallowed.

The committee agreed to not disallow numeric separators in the fractional or exponential parts of NonOctals at this point.

Thanks!

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

No branches or pull requests

4 participants