You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose we allow underscores in numeric literals after the base prefix and before the type suffix.
Currently, leading/trailing underscores in numeric literals are not allowed after the prefix or before the suffix. This lessens readability because the leading and trailing groups blend into the additional characters and lose their visual "shape".
0b1111_1111uy // valid
0b_1111_1111_uy // not valid (proposal to allow)
Is there a rationale for disallowing these underscores? According to RFC FS-0005, the rules seem to be modeled after a pre-existing ruleset from Java. There don't seem to be arguments for or against this specific restriction so it's not clear if it was actively favored or if it just came along for the ride. (Thus I don't believe this necessarily counts as "already been decided" per the affidavit below.)
Also note that some other languages have chosen to be less restrictive:
0b_1111_1111 // C# 7.2 - leading underscore valid
0b_1111_1111_u8 // Rust - leading and trailing underscore valid
This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.
Please tick all that apply:
This is not a breaking change to the F# language design
I or my company would be willing to help implement and/or test this
The text was updated successfully, but these errors were encountered:
I propose we allow underscores in numeric literals after the base prefix and before the type suffix.
Currently, leading/trailing underscores in numeric literals are not allowed after the prefix or before the suffix. This lessens readability because the leading and trailing groups blend into the additional characters and lose their visual "shape".
Is there a rationale for disallowing these underscores? According to RFC FS-0005, the rules seem to be modeled after a pre-existing ruleset from Java. There don't seem to be arguments for or against this specific restriction so it's not clear if it was actively favored or if it just came along for the ride. (Thus I don't believe this necessarily counts as "already been decided" per the affidavit below.)
Also note that some other languages have chosen to be less restrictive:
(C# reference, Rust reference)
Pros and Cons
The advantages of making this adjustment to F# are: better readability
The disadvantages of making this adjustment to F# are: none that I know of
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: F# RFC FS-0005 - Underscore Literals
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: