> On 27 Jun 2016, at 00:57, Russ Bishop via swift-evolution 
> <[email protected]> wrote:
> 
> 
>> On Jun 22, 2016, at 11:48 PM, David Hart via swift-evolution 
>> <[email protected]> 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
>> [email protected]
>> 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
> [email protected]
> 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
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to