-
Notifications
You must be signed in to change notification settings - Fork 440
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
Support underscores or other separators in numeric literals. #1155
Comments
This would be valuable. Tons of big numeric constants embedded in jsonnet out there. This would be a deviation from json, but ECMAScript has digit separators. Would the mods look favorable upon this addition? |
SGTM but there's quite a diversity in approaches across languages. Jsonnet typically tries to be compatible with Python or ECMAScript so what is the difference between PEP-0515 and the ECMAScript approach? |
ES6 and Python both allow |
Differences between the two seem to be:
Actually, I'll have to take a closer look later, but among the subset of ECMAScript things that Jsonnet supports (e.g., no octals), that's the only difference I've noticed so far. The big thing they both have in common is that each underscore can appear between two numerals (0-9), and nothing else can be touching the underscore. Not an |
Since that's the only difference I can find, what if we just followed ECMAScript? To put it into words:
Happy to put this in a doc or something more amenable to commenting. David |
It would be nice to have support for underscores in numeric literals to be able to write
500_000_000
instead of500000000
. This is a common feature for digit grouping in languages. See e.g. PEP-0515.The text was updated successfully, but these errors were encountered: