[swift-evolution] Move placement of 'throws' statement

Tino Heth 2th at gmx.de
Tue Dec 27 16:04:55 CST 2016


> 
> Under the hood each expression passed to "throw" could make something like
> 
> enum bar_abcdefj_throw {
> case genericError // all NSError go here
> case MyEnumErrorFirstError
> }
> 
> Where abcdefj is unique characters.
> 
> 
> This enum would only be visible through the catch blocks which would act like a switch statement.

Imho that's to much magic and way to special, and as errors often are regular enums themselves, we'd end up in two levels of them.

There has been a discussion about ad-hoc enums before, but those were supposed to be used as parameters (which seems lot less complicated to me — but still wasn't simple enough to be added to the language).


More information about the swift-evolution mailing list