[swift-evolution] [Pitch] Typed throws

Matthew Johnson matthew at anandabits.com
Fri Feb 17 13:29:34 CST 2017


> On Feb 17, 2017, at 1:24 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Let's not bring bikeshedding the commonly proposed and rejected union spelling into this.
> Typed throws would be a nice addition, assuming that the core team finds it in scope for phase 2. It seems only logical that any type can be thrown (i.e. conforms to Error) should be permitted to be listed in `throws()`.

Agree.  Typed throws should have a single thrown type.  Making it more convenient to throw and catch more than one error type with typed throws without having to manually create a wrapper is an orthogonal issue.  David Owens convinced me of this last year when we had a thread on the topic.

> 
> 
> On Fri, Feb 17, 2017 at 1:18 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> That’s what I thought too. That’s also the case I showed a simple example how we could solve the giant list with a typealias even if the pipe | operator would be exclusive for anything that conforms to Error.
> 
> 
> 
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> Am 17. Februar 2017 um 20:16:30, Anton Zhilin (antonyzhilin at gmail.com <mailto:antonyzhilin at gmail.com>) schrieb:
> 
>> 2017-02-17 22:12 GMT+03:00 Adrian Zubarev via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
>> 
>> 
>> Is the throwing type always a protocol? In your example it is, but is this going to be always the case?
>> 
>> 
>> I thought it was going to be any one subtype of 
>> Error, be it a struct, an enum, or a protocol existential, or 
>> Error itself.
>> 
> 
> 
> 
> _______________________________________________
> 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>
> 
> 
> _______________________________________________
> 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/dff9a092/attachment.html>


More information about the swift-evolution mailing list