Skip to content

make numeric literal juxtaposition less brittle #15731

Closed
@StefanKarpinski

Description

The most obvious two changes would be:

  • disallow 0 as a juxtaposed numeric literal coefficient: 0n would be a syntax error.
  • disallow juxtaposition of floating-point numeric literals with trailing .: 1.x would be a syntax error.

There may be others but these two strike me as clearly a good idea. One nice thing about disallowing 0 as a juxtaposed numeric literal coefficient is that it opens up as many 0x1234 syntaxes as one might ever want, so it kind of future-proofs us for that. Another nice thing is that instead of getting a surprise when they try 0x after 0y just working, people will get a warning as soon as they try 0y and they can immediately learn that 0 doesn't work as a juxtaposed numeric literal coefficient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

breakingThis change will break codeparserLanguage parsing and surface syntaxspeculativeWhether the change will be implemented is speculative

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions