[swift-evolution] Strings in Swift 4

Sean Heber sean at fifthace.com
Fri Jan 20 17:08:18 CST 2017


>> * The talk about implicit conversions between Substring and String bums me
>> out, even though I see the importance of it in this context and know that
>> it outweighs the alternatives. Given that the Swift team seems to prefer
>> explicit to implicit conversions in general, I would hope that if they feel
>> it's important enough to make a special case for the standard library, it
>> could be a language feature that you'd consider making available to
>> anyone.
> 
> Not speaking for the whole team, I personally feel we should make it
> generally available, but I also recognize that we'll likely have to roll
> out the String reimplementation before we have time to properly design
> a general “struct subtyping” feature for end-users.

I may not be following this properly, but isn’t this sort of situation what protocols are for? Why couldn’t String be a protocol and there be something like UnicodeString and UnicodeSubstring and they both implement the String protocol?

l8r
Sean


More information about the swift-evolution mailing list