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

[spec/test/interpreter] Allow underscores in numbers #527

Merged
merged 1 commit into from
Jul 25, 2017
Merged

Conversation

rossberg
Copy link
Member

Allow literals like 1_000, 0xfff_ffff, 3.145_692 etc, as discussed earlier.

@rossberg rossberg requested a review from binji July 20, 2017 20:00
@binji
Copy link
Member

binji commented Jul 21, 2017

FYI: Found this as a useful reference for prior art: https://www.python.org/dev/peps/pep-0515/#prior-art.

edit: and this https://github.com/tc39/proposal-numeric-separator#prior-art

Seems as though most languages allow underscores only between digits (like you've done here). It also seems that most languages allow multiple consecutive underscores (unlike here). I don't think it's a big deal either way, though.

@rossberg
Copy link
Member Author

I'd be fine with allowing multiple consecutive underscores. I merely went for the most conservative option.

@samuelgoto
Copy link

samuelgoto commented Jul 25, 2017

(edit: ah, nevermind, i see that that has already been pointed out earlier in the thread. sorry, carry on with the good work :))

FWIW, this is a similar discussion in JS land that may help inform your design (e.g. tradeoffs and prior art).

https://github.com/tc39/proposal-numeric-separator

@samuelgoto
Copy link

I'd be fine with allowing multiple consecutive underscores. I merely went for the most conservative option.

FWIW, the most conservative option is to allow non consecutive underscores. You can always change that later (we haven't found enough evidence that it adds anything) but not retract otherwise. This is the direction that JS is going to with that regards.

ngzhian added a commit to ngzhian/spec that referenced this pull request Nov 16, 2021
rossberg added a commit that referenced this pull request Apr 21, 2024
Fix an example code for ref.cast in MVP.md
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.

3 participants