[swift-evolution] [Review] SE-0005 Better Translation of Objective-C APIs Into Swift

Matthew Johnson matthew at anandabits.com
Mon Feb 1 15:51:57 CST 2016


> On Feb 1, 2016, at 3:40 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> On Feb 1, 2016, at 1:38 PM, Drew Crawford <drew at sealedabstract.com <mailto:drew at sealedabstract.com>> wrote:
>> 
>> 
>>> On Feb 1, 2016, at 1:02 PM, Tony Parker <anthony.parker at apple.com <mailto:anthony.parker at apple.com>> wrote:
>>> 
>>> Types like NSURL are intended to be the canonical URL for everyone to use,
>> 
>> 
>> I think the "canonical URL for everyone to use" must be a value type / struct.  To me this seems axiomatic.
>> 
>> Meanwhile (NS)URL cannot be a value type because of the Darwin compatibility mandate, and to change from value->reference semantics would be "off the charts" breakage severity.
>> 
>> This is a requirements conflict.  corelibs-foundation can either be Darwin-compatible or it can be canonical, but we cannot do both.  Right now we have chosen Darwin-compatible, so we must let the canonical requirement go.   Unprefixed "URL" should be reserved for the value type that can actually work as a canonical API.
> 
> One could imagine bridging NSURL to a value type URL (provided by Foundation, and initially implemented as a value-semantic wrapper around NSURL), the same way we bridge NSArray/NSDictionary/NSSet/NSString. 

Sure, and that would be perfectly acceptable.  If that (or something similar) is the long-term plan it seems like a particularly bad idea to drop `NS` from them right now.  

That would mean we have a `URL` reference type in Swift 3 Foundation which becomes a value type in a future Swift X Foundation.  This change would likely be very problematic.

> 
> 	- Doug
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160201/f233a58c/attachment.html>


More information about the swift-evolution mailing list