[swift-evolution] [Review] SE-0010 Add StaticString.UnicodeScalarView
kevin at sb.org
Sat Jan 9 00:22:14 CST 2016
On Fri, Jan 8, 2016, at 09:56 PM, Jacob Bandes-Storch wrote:
> Question: Why doesn't this proposal also include UTF8View and UTF16View?
Mostly because those are extra work and I didn't see much benefit to
them. The point of this addition is simply to make it possible to slice
StaticStrings and get something useful. If you want to work with UTF-8
you can already use the utf8Start + byteSize properties (assuming the
StaticString isn't storing a single unicode scalar), and if you want to
work with UTF-16, you probably already want to be using String. Also,
even if we had a UTF8View and a UTF16View, you couldn't actually use
them to slice the StaticString since a StaticString must contain a valid
unicode sequence. They could have methods to translate from UTF8/UTF16
indices into UnicodeScalarView indices like String does, but ultimately,
it seems like a lot of work for something that nobody's actually going
to get around to using.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution