Is there an existing issue for this?
Task description
Follow-up to #1315 (step 2-3 of the plan in #1315 (comment)).
Now that IBufferWriter<char> and Append(ReadOnlySpan<char>) are going to be in place (as of #1315), we can move off ICharSequence on the buffer types.
Phase 1 - Rework callers (non-breaking)
Replace internal logic that consumes ICharSequence (from CharTermAttribute, OpenStringBuilder, and other buffer types) with ReadOnlySpan<char> or ReadOnlyMemory<char> where appropriate. This is purely internal call-site refactoring and must land before the removal below.
Phase 2 - Remove the implementation (breaking)
Remove the ICharSequence implementation from ICharTermAttribute and all buffer types at the same time:
- Drop
SubSequence() and HasValue.
- Promote any still-needed members directly onto
ICharTermAttribute.
Known consequence
Because the compiler does not honor a concrete type's implicit operators through an interface, callers will need to call .AsSpan() explicitly on ICharTermAttribute to pass it into ReadOnlySpan<char> APIs. On the upside, once ICharSequence is gone there is no risk of accidentally routing a value into an ICharSequence API when ReadOnlySpan<char> is the better choice.
This is a breaking change and should be done in a beta release before 4.x final.
Is there an existing issue for this?
Task description
Follow-up to #1315 (step 2-3 of the plan in #1315 (comment)).
Now that
IBufferWriter<char>andAppend(ReadOnlySpan<char>)are going to be in place (as of #1315), we can move offICharSequenceon the buffer types.Phase 1 - Rework callers (non-breaking)
Replace internal logic that consumes
ICharSequence(fromCharTermAttribute,OpenStringBuilder, and other buffer types) withReadOnlySpan<char>orReadOnlyMemory<char>where appropriate. This is purely internal call-site refactoring and must land before the removal below.Phase 2 - Remove the implementation (breaking)
Remove the
ICharSequenceimplementation fromICharTermAttributeand all buffer types at the same time:SubSequence()andHasValue.ICharTermAttribute.Known consequence
Because the compiler does not honor a concrete type's implicit operators through an interface, callers will need to call
.AsSpan()explicitly onICharTermAttributeto pass it intoReadOnlySpan<char>APIs. On the upside, onceICharSequenceis gone there is no risk of accidentally routing a value into anICharSequenceAPI whenReadOnlySpan<char>is the better choice.This is a breaking change and should be done in a beta release before 4.x final.