-
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
Richer literals: TimeSpan/DateTime/Char array/UTF8 #21
Comments
Type providers can be used to implement a very large range of literal forms. See for example: https://github.com/toburger/DateTypeProvider. Closing this since that extension mechanism is available. |
Posting here rather than creating a new issue. See this lengthy issue detailing scenarios and designs around UTF-8 for .NET. Of particular interest here is that this is critical work for ML.NET. The bulk of this is in the runtime, but there are some language-level considerations, such as a possible representation for literals. There is a C# proposal for UTF-8 string literals with some interesting discussion. The primary motivation:
From a principles standpoint I really do hate the idea of bifurcating strings, even though the space is inherently complicated once you dive into it. Given that .NET uses UTF-16 for The question in my mind is that if using a Type Provider can result in the same performance as if there were some language-level support for UTF-8 literals if you need to use them in, e.g., a hot loop. If it can, then the next question is if people consider that an acceptable dependency for working in scenarios outlines by the CoreFX Lab issue. |
I followed a link to this discussion from a separate C# proposal where I made some points that I think that would be valid here for F#. @dsyme I took a brief look at the DateTime literal type provider example that you pointed to but the syntax appears a bit outside of the proposed typical prefix/suffix approaches. I'm curious if by using Type providers if anything close to the syntax used with the ES6 feature for |
Richer literals: TimeSpan/DateTime/Char array/UTF8 [11109258]
Submitted by Tom Rathbone on 12/16/2015 12:00:00 AM
4 votes on UserVoice prior to migration
Combining several suggestions for richer literals
"01:02:03"T --> new TimeSpan(1,2,3)
"2015-01-02 10:30:00"D -> new DateTime(2015,01,02,10,30,00)
"abcd"C
and indeed perhaps the whole mechanism should be extensible like QZRING literals
Original UserVoice Submission
Archived Uservoice Comments
The text was updated successfully, but these errors were encountered: