[swift-evolution] Proposal: Allow Type Annotations on Throws

David Owens II david at owensd.io
Fri Dec 18 10:58:44 CST 2015

> On Dec 18, 2015, at 7:03 AM, Félix Cloutier <felixcca at yahoo.ca> wrote:
> For this reason, I don't like to encourage throwing polymorphic types, and I think that it's a misconception to pretend that having a single type in the throws annotation ensures that the function throws a single type. In my opinion, the fact that it's currently possible but awkward to use polymorphic types as errors is exactly as much support as the feature should receive.

I don’t follow this. Declaring a type that is an enum or a struct absolutely guarantees that the function only returns a single type. If the type is a class-based error, then sure, there’s not guarantee.

However, the only option today is polymorphic error types. 


More information about the swift-evolution mailing list