[swift-evolution] Partial list of open Swift 3 design topics

Karl razielim at gmail.com
Tue Jun 28 00:11:54 CDT 2016


> On 27 Jun 2016, at 00:57, Russ Bishop via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jun 22, 2016, at 11:48 PM, David Hart via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>> - <rdar://15821981> Bridge NSRange to “Range<Int>?”
>> 
>> I don’t think I can handle writing a proposal for this one, but I’d die for it.
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> Will this work the way people expect, especially given how NSString handles unicode vs Swift String and the various views? My suspicion is at least a chunk of the things people imagine doing with the bridged NSRange won’t actually work and they’ll be sad.
> 
> Russ
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

This is a good point. I asked @CC Tony Parker recently about doing the conversion inside Foundation and just exposing Range<String.Index> directly. 

Basically everybody who uses those Foundation methods which return an NSRange for strings needs to write their own conversion functions anyway, and less-experienced developers might not get the UTF-16 thing correct. That’s something we should be handling for them; it’s an implementation detail of the underlying CoreFoundation APIs.

Karl


More information about the swift-evolution mailing list