<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">There's no reason we couldn't do some tooling work to expose emergent information about what kinds of errors are thrown by the current implementation of a function, and maybe even check that against the current documentation. &nbsp;Certainly, it should be possible to document particularly interesting errors that a function might throw. </div></div></blockquote><div>I'd prefer moving some complicated and controversial questions out of the language level, and probably, this might be such a case — but I think the preferred syntax would not be "throws(NetworkError, MyError) func mayFail() throws", but rather something that looks much more integrated ("func mayFail() throws(NetworkError, MyError)")</div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I'm just challenging the idea that this should be reflected and enforced in the type system.</div></div></blockquote><div>Yes, I think this might be a can of worms — just imagine rethrows, where some errors will always be caught, so that ultimately, we would steer towards some kind of type algebra just for errors...</div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">Typed throws could also help to lessen the tight coupling to Objective-C:</div><div class="">Being forced to declare conformance to a protocol without requirements or even public methods feels very awkward to me.</div></div></div></blockquote><div class=""><br class=""></div>Error is not about Objective-C interop; we could make the feature work without a protocol, and in fact the protocol alone isn't sufficient for what we try to do with it. &nbsp;The protocol's value is mostly communicative, a way of making it obvious that a type is meant to be thrown</div></div></blockquote><div>I guess nearly all uses look like "XYError: Error", so I really don't see much value in the protocol; but to me, it always feels a little bit dirty when language features are entwined with certain types, so it might be just a personal oddity.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">If people want to build huge lists of possible errors… why not? As long as I'm still able to write my own throwing functions as today, I'm fine with that.</div></div></div></blockquote><div class=""><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Language features have to meet a higher bar than "why not?".</span><br class="Apple-interchange-newline"></div></blockquote></div>That was more geared towards something I'd consider as derailed use — but it seems we agree that typed throws don't have to be something to bother the compiler with.<div class=""><br class=""></div><div class="">- Tino</div></body></html>