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

Scott James Remnant scott at netsplit.com
Thu Jun 30 13:30:14 CDT 2016


+1

I continually find the use of `as` for bridging between Objective-C and Swift types to be confusing, since they do not have a true place in the Swift type hierarchy and are not simple casts. The `catch let error as NSError` construct always implies that NSError is a true type that can be thrown, and this confusion gets worse in the places where NSError “leaks” out of APIs and you can’t actually cleanly bridge from an ErrorProtocol anyway.

One comment though:

Why is the errorDescription of LocalizedError an optional? Why would a type conform to this protocol, and then choose not to provide its only extension to ErrorProtocol?


Scott


More information about the swift-evolution mailing list