[swift-evolution] [Review] SE-0112: Improved NSError Bridging

Douglas Gregor dgregor at apple.com
Fri Jul 1 19:26:57 CDT 2016


> On Jul 1, 2016, at 5:25 PM, Charles Srstka <cocoadev at charlessoft.com> wrote:
> 
>> On Jul 1, 2016, at 4:12 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> FYI, in-progress implementation is available at:
>> 
>> 	https://github.com/apple/swift/tree/nserror-bridging <https://github.com/apple/swift/tree/nserror-bridging>
>> 
>> The only issue I’ve found so far with the proposal is this bit:
>> 
>> 	When we introduce this bridging, we will need to remove NSError's conformance to ErrorProtocol to avoid creating cyclic implicit conversions. However, one can still explicitly turn an NSError into ErrorProtocol via a bridging cast, e.g., nsError as ErrorProtocol.
>> 
>> This doesn’t work, because the model really needs NSError to conform to ErrorProtocol. Instead, we should break the implicit conversion by not allowing an implicit conversion from an arbitrary ErrorProtocol to NSError, which is in line with what SE-0072 would do anyway.
> 
> What exactly in the model causes it to require NSError to conform to ErrorProtocol?

ErrorProtocol uses a single-pointer, boxed representation where an NSError pointer can be used directly. Basically, ErrorProtocol is represented as an NSError, always.

	- Doug


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160701/ad61170b/attachment.html>


More information about the swift-evolution mailing list