<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 18.02.2017 um 17:37 schrieb Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you for taking the time to put this proposal together Anton! I really want to see typed throws make it into Swift 4. This will be a very nice feature to have.<div class=""><br class=""></div><div class="">I noticed that you included Joe Groff’s idea of replacing `rethrows` by making every function have an error type which is by default `Never` for non-throwing functions and `Error` for throwing functions that do not specify an error type. </div><div class=""><br class=""></div><div class="">I want to urge you to consider updating the proposal to take this direction now rather than later. This is a breaking change which means the longer we wait the harder it is to justify. In fact, I think incorporating the breaking change could increase the chances of it being accepted for Swift 4. Without that it is a purely additive change and those are not being given priority in the Swift 4 release.</div></div></div></blockquote><div><br class=""></div><div>Seconded.</div><div>With typed throwing function parameters, it makes a lot of sense to be able to specify the rethrown type, based on the function given as parameter.</div><div><br class=""></div><div>Now some bike-shedding:</div><div>I’m not really happy with the `throws(Type)` syntax, as it is too close to function parameters.</div><div>Why exactly is `throws Type` ambiguous?</div><div>The proposal mentions `Type -> Result` as potential thrown type, but functions cannot conform to `Error`.</div><div>Maybe we can instruct the parser to just allow simple type names between `throws` and the arrow `->`.</div><div><br class=""></div><div>If that is not possible, we should at least try to find some visual hints to separate Error type from function parameters.</div><div><br class=""></div><div>E.g. we could use brackets (think of: we are specialising the `throws`):</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><span class="pl-k" style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">func</span><span style="color: rgb(51, 51, 51); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247);" class=""> </span><span class="pl-en" style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(121, 93, 163);">foo</span><span style="color: rgb(51, 51, 51); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247);" class="">() </span><span class="pl-k" style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">throws</span><span style="color: rgb(51, 51, 51); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247);" class=""><MyError> { </span><span class="pl-k" style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247); box-sizing: border-box; color: rgb(167, 29, 93);">…</span><span style="color: rgb(51, 51, 51); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; background-color: rgb(247, 247, 247);" class=""> }</span><div class=""><br class=""></div> — Martin</div></div></body></html>