-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add TimeSpan Span-based APIs #22814
Comments
@stephentoub didn't realize that dotnet/corefx#22406 was not up-for-grabs. How about this one? Quite smaller than dotnet/corefx#22403. Also it will help me get started after a gap. Thanks! |
Ok. Analyzed what this potentially involves. I believe it goes all the way down to the tokenizer in the TimeSpanParser as well to replace |
That's generally the right approach, but this one is tricky as, in its current design, that would result in a span getting stored as a field in another type, and as a ref-like type, spans can only be stored as fields in other ref-like types, and at the moment there's no way to indicate that in C#. Even if the runtime doesn't currently complain, it will end up producing compilation errors later when the C# compiler verifies such things. |
I guess you are referring to |
There are several, like TimeSpanTokenizer. |
Ouch. Everything was compiling well 😆 and I was very happy! Hmmm... Essentially we have to choose between these types which are |
We can't make those classes; that would result in allocations we need to avoid while parsing. It may be that we need to wait to tackle this issue until we have an updated compiler that will appropriately validate ref structs. |
Yup got it. We may live with
So should I take up something else, that I have got hang of what is to be done in such type of cases? |
Probably. How about the span-based TextReader/Writer methods, and the overrides on various types like StreamWriter? You won't be able to do the buffer-based overloads yet, but you should be able to do the span-based ones. |
Yup... was just typing 'may I' request in dotnet/corefx#22406 :-) |
Separated out of https://github.com/dotnet/corefx/issues/21281 for tracking purposes.
The text was updated successfully, but these errors were encountered: