[swift-evolution] Strings in Swift 4

Brent Royal-Gordon brent at architechies.com
Tue Jan 24 08:30:54 CST 2017


> On Jan 23, 2017, at 9:59 PM, FĂ©lix Cloutier via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> You can do it, but it trades one semantic problem for a usability problem, without solving all the semantic problems: you end up with a.count + b.count == (a+b).count, sure, but you still don't satisfy the usual law of collections that (a+b).contains(b.first!) if b is non-empty, and now you've made it difficult to attach diacritics to base characters.
> 
> "Difficult".
> 
> What kind of processing would you suggest on a variable "b" in the expression "\(a),\(b)" to ensure that the result can be split with a comma?

Use of the `extendedASCII` view to parse it. :^)

In all seriousness, though, maybe this just means you should be parsing at the `unicodeScalars` level or below when you're doing this kind of thing.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list