-
Notifications
You must be signed in to change notification settings - Fork 18k
Numeric literals with spaces as delimeters #42
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
Labels
Comments
You could implement Serge's good idea using the existing special symbol "_" (Underscore) which Go uses to say "present but missing" in other contexts. This would make parsing effortless. const ( nanoseconds_per_second = 1_000_000_000; packed_primes = 0x_02_03_05_07_0B_0D_11_13; epsilon = 0.000_001; ) It shares most of the benefit, avoids the issue of a spaced-out hexadecimal literal with a segment beginning with [a-fA-f] seeming like a non-number, and adds a bit of Ada to Go. |
Really Erlang copies Ada approach with small change (Ada #p#n -> Erlang p#n). I also vote for this - it gives much readability without any syntax conflict. Also I vote for discarding treating "0..." as octal (in #145). (To justify myself: this of course seems like bikeshed, but IMHO it really influes the readability) |
"Your request isn't unreasonable, but we are very conservative with language features." What a ridiculous comment. How about banning multiple spaces -- or even all unnecessary spaces, in programs because allowing them isn't "conservative"? What about unicode identifiers -- *that* isn't conservative! Allowing underscores within numeric constants is a small upwards-compatible change localized to the lexer -- it barely deserves to be called a "feature". |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by Serge.Sitnikov:
The text was updated successfully, but these errors were encountered: