We should be able to develop the simple collection-taking findRange
at any time. We’ll want to do a Pattern approach in the future and that could check for a trivial pattern and forwards on to the simple collection-taking findRange
.
The also sounds good to me, unless we can figure out the DSL approach soon. I do think we will want this on UnicodeScalarView and probably the code unit views.
I agree, and I’m actually fine with Dave’s syntax (though I expect that to be highly controversial). Your thoughts on the syntax?
Interesting. Could you elaborate more on what you’d want to be able to express and how RangeExpression
cannot meet that? Maybe instead of a slicing DSL we have a range DSL.
I think the pressing need would be for the whitespace special case for [Sub]String (likely based on Character.isWhitespace assuming it reconciles degenerate graphemes), UnicodeScalarView (using Unicode.Scalar.Properties.isWhitespace), and maybe code unit views (if useful) as aliases for the USV solution.
Beyond that, let’s see if a Pattern abstraction covers all the others well.
For the mutating trim
operation, I wonder if it would be best on RangeReplaceableCollection, which can delete prefixes or suffixes in-place.