Repository navigation
[RFC FS-1352] Interpolated strings in constant expressions #854
xperiandri
started this conversation in
Language and core library RFC discussions
Replies: 1 comment 3 replies
Is there a good reason to aim for "parity with C#" in this case? F# format specifiers are already an inherent difference with no equivalent in C#. Assuming invariant culture actually guarantees consistent formatting, then being able to take advantage of that in F# seems useful. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Discussion thread for RFC FS-1352: #853
The RFC makes an interpolated string a constant expression when each hole is a non-null constant
stringexpression without alignment or format specifiers. These are the rules of C# 10 constant interpolated strings.[<Literal>]values, attribute arguments and type provider static arguments can then use interpolation, as they already use+:Design points:
{{,}}and%%escapes processed. So a constant interpolated string can also be a printf format literal.int,charandbooltypes are rejected for parity with C#, although F# formats them with the invariant culture. A plain%s{e}hole is rejected for the same reason.nullconstant hole is an error, as in C# (CS0133) and as for+in F# today.All reactions