[swift-evolution] Type-annotated throws

Xiaodi Wu xiaodi.wu at gmail.com
Fri Aug 26 12:10:35 CDT 2016


I think the core team has previously mentioned some positive notions about
typed throws, so it'd be interesting to hear what they have in mind at this
point (or, more likely, at the point when they're no longer swamped with
getting Swift 3 out the door).


On Fri, Aug 26, 2016 at 11:55 AM, Rod Brown via swift-evolution <
swift-evolution at swift.org> wrote:

>
> On Fri, Aug 26, 2016 at 5:43 PM, Rod Brown via swift-evolution <swift-
> evolution at swift.org> wrote:
>
>> (resent for Swift Evolution)
>>
>> I’m a big fan of this idea. Currently “throws” seems like a very limited
>> API - you know it’s throwing out something, but you can only hope to guess
>> what that is or create fallbacks. Definitely a big +1 from me. A fallback
>> for compatibility could be “throws” assumes “throws Any” and can be a
>> warning?
>>
>
> I’d suggest a bare `throws` = `throws ErrorType` (you can only throw
> ErrorType, right?) and be valid, I don’t see any reason to make it a
> warning (plus that keeps source compatibility).
>
>
>
> *hits head on desk*
>
> How could I miss that?  `throws` = `throws ErrorType` makes perfect sense.
> It also means we can get some type safety, but it’s not lock in.
>
> Thanks :)
>
> -Rod
>
> _______________________________________________
> 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/20160826/edb8c683/attachment.html>


More information about the swift-evolution mailing list