[swift-evolution] [Pitch] Typed throws

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Feb 17 13:36:35 CST 2017


Sorry I meant “recover from MyError (protocol)”.



-- 
Adrian Zubarev
Sent with Airmail

Am 17. Februar 2017 um 20:30:35, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:

The function that throws MyError might contain your error enum (or other types in general), but you would have to recover from MyType to the dynamic type first.



-- 
Adrian Zubarev
Sent with Airmail

Am 17. Februar 2017 um 20:26:48, Xiaodi Wu (xiaodi.wu at gmail.com) schrieb:

On Fri, Feb 17, 2017 at 1:22 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
Sure thing, but that’s not what I was asking about. Kevin made a protocol that conforms to Error where all the his enums conformed to MyError protocol. That way we’re losing all enum cases and are not really a step further as before.


Sorry, can you elaborate? What do you mean by losing enum cases?

Am 17. Februar 2017 um 20:18:48, David Sweeris (davesweeris at mac.com) schrieb:


On Feb 17, 2017, at 11:12 AM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:

Is the throwing type always a protocol? In your example it is, but is this going to be always the case?

I think right now, there’s a bit of compiler magic in that you can only throw something that conforms to `Error`.

- Dave Sweeris

_______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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


More information about the swift-evolution mailing list