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

Editorial: Simplify the |NumericLiteral| grammar #3096

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gibson042
Copy link
Contributor

Best reviewed by commit.

CanonicalDecimalIntegerLiteral
NonOctalDecimalIntegerLiteral

CanonicalDecimalIntegerLiteral ::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might there be a better name than CanonicalDecimalIntegerLiteral? It makes me think “canonical numeric string”, which corresponds to neither a superset nor subset of the sequences this production matches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, suggestions welcome. But the similarity to "canonical numeric string" is intentional, and the two concepts do mostly agree where they intersect—not for power-of-two numbers large enough that Number::toString uses exponential notation, but I'm willing to chalk that up as a difference between canonicalized numeric strings vs. integer literals (numeric strings and integer literals already being distinct with respect to e.g. supporting _ separators).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for power-of-two numbers large enough that Number::toString uses exponential notation

Even without exponential notation, stuff beyond safe integer range won’t always be canonical in the CNS sense, right? For example the source text literal 9007199254740993 evaluates to the Number value whose canonical string representation is 9007199254740992.

the similarity to "canonical numeric string" is intentional

In that case, perhaps I’m alone in thinking the word might be misleading there, so unless others have an opinion it’s probably not worth changing.

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

Successfully merging this pull request may close these issues.

None yet

2 participants