Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Extend available suffixes for numeric literals #845
Extend available suffixes for numeric literals
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
module NumericLiterali = let inline FromZero() = System.Numerics.Complex.Zero let inline FromOne() = System.Numerics.Complex.ImaginaryOne let inline FromInt32 (n:int) = System.Numerics.Complex(0., float n) let bigInteger = 1I let complex = 1i
module NumericLiteralh = let inline FromZero() = System.Half 0.f let inline FromOne() = System.Half 1.f let inline FromInt32 (n:int) = System.Half n let half = 1h // Not Q, R, Z, I, N or G which don't make sense for a half literal.
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
Estimated cost (XS, S, M, L, XL, XXL): M
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply: