-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Adds SpanSplitEnumerator
#104534
Adds SpanSplitEnumerator
#104534
Conversation
Note regarding the
|
1 similar comment
Note regarding the
|
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
8c52bf2
to
dd98d20
Compare
@bbartels, please let us know when this is ready for review. |
Will do, will finish off over the weekend! |
Ok, thanks |
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/String.SplitTests.cs
Outdated
Show resolved
Hide resolved
@stephentoub ready for review 🙂 |
Thanks. Given the time pressure, I'm making changes in a commit locally which I'll push to your branch for you to explore. |
Done. @bbartels, please take a look. Most important changes:
|
Was this discussed in api review? I have no recollection. I could see that being rather concerning behaviour special casing this for a single type. |
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
I believe it's implied by these APIs behaving the same as the other overloads. I think it's more concerning that you'd switch from strings to spans and your use silently behaves differently. If we really don't like the discrepancy, we should change these to be specific to char rather than T. But then keep in mind that if we ever added T-based overloads, you'd still have the exact same difference in behavior when specifying char vs other types, binding to one overload with one behavior vs the other with the other. (Also various APIs for spans already special-case char, e.g. span.ToString). |
Fair point, I guess there is realistically no way around just supporting this quirk in some way. |
@stephentoub I've had another look into simplifying things a little. Came up with this: https://github.com/bbartels/runtime/pull/1/files. Thoughts?
Downside: |
We could. I have a small preference for what's currently in this PR just because I think it's a bit easier to understand. |
Alright, up to you, I trust your judgement! Otherwise lgtm from my perspective |
e537a6e
to
d620771
Compare
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Split.cs
Outdated
Show resolved
Hide resolved
Thanks, @bbartels. |
Implements #934
TODO:
IEquatable<T>
type constraint is necessary due to the type constraint existing on theSystem.MemoryExtensions.IndexOf<T>()
overloads and onSearchValues<T>
.