Closed gopherbot closed 9 years ago
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".
by Serge.Sitnikov: