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 extend available suffixes for numeric literals to include all capital and small English alphabets after F. The reason for not allowing A to F is to avoid ambiguities after supporting hexadecimal integer literals.
The existing way of approaching this problem in F# is using the current set of suffixes Q, R, Z, I, N and G.
Pros and Cons
The advantages of making this adjustment to F# are
Allowing more numeric literals without suffix collision.
moduleNumericLiterali =let inlineFromZero()= System.Numerics.Complex.Zero
let inlineFromOne()= System.Numerics.Complex.ImaginaryOne
let inlineFromInt32(n:int)= System.Numerics.Complex(0., float n)letbigInteger=1I
letcomplex=1i
Allowing for suffixes that make more sense. For example, with a System.Half, we can write
moduleNumericLiteralh =let inlineFromZero()= System.Half 0.f
let inlineFromOne()= System.Half 1.f
let inlineFromInt32(n:int)= System.Half n
lethalf=1h // Not Q, R, Z, I, N or G which don't make sense for a half literal.
Less rote memorization of rules! (what do QRZING stand for, anyways?)
The disadvantage of making this adjustment to F# is the decreased ability for F#e to add new numeric literals without breaking changes. However, this can be handled with the same way as BigInteger literals where NumericLiteralI can be overridden by users.
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 extend available suffixes for numeric literals to include all capital and small English alphabets after F. The reason for not allowing A to F is to avoid ambiguities after supporting hexadecimal integer literals.
The existing way of approaching this problem in F# is using the current set of suffixes Q, R, Z, I, N and G.
Pros and Cons
The advantages of making this adjustment to F# are
The disadvantage of making this adjustment to F# is the decreased ability for F#e to add new numeric literals without breaking changes. However, this can be handled with the same way as BigInteger literals where
NumericLiteralI
can be overridden by users.Extra information
Estimated cost (XS, S, M, L, XL, XXL): M
Related suggestions:
#754
#844
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: