-
Notifications
You must be signed in to change notification settings - Fork 21
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
Decimal, nativeint and unativeint literals #847
Comments
Marked this approved-in-principle |
One minor suggestion, the name "unativeint" looks a bit like "un-native int" to me. Consider "NativeUInt"? |
No. |
What is expected in terms of codegen for a decimal literal? [<Literal>]
let lit01 = 35 we generate
But decimal requires the initialization of a |
Yes, in case of const, it should be done via attribute and initonly value: .field public static initonly valuetype [System.Runtime]System.Decimal dconst
// Value:
.custom instance void [System.Runtime]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8, uint8, uint32, uint32, uint32) = (01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00) Additionally, there's a .method private hidebysig specialname rtspecialname static void .cctor () cil managed
{
IL_0000: ldsfld valuetype [System.Runtime]System.Decimal [System.Runtime]System.Decimal::One
IL_0005: stsfld valuetype [System.Runtime]System.Decimal Constants::dconst
IL_000a: ret
} for |
Decimal, nativeint and unativeint literals
I propose we allow decimal, nativeint and unativeint literals.
The existing way of approaching this problem in F# is (none).
C# 9 now has native-sized integers.
Together with decimal constants, C# 9 can now define three types of literals that F# cannot. To interface with them, we must be able to interpret and define decimal, nativeint and unativeint literals.
Pros and Cons
The advantages of making this adjustment to F# are
The disadvantages of making this adjustment to F# are none that I can think of.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions:
#562
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: