<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="">On Feb 23, 2017, at 12:30 PM, Anton Zhilin <<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">2017-02-23 21:01 GMT+03:00 Matthew Johnson <span dir="ltr" class=""><<a href="mailto:matthew@anandabits.com" target="_blank" class="">matthew@anandabits.com</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class="">I don’t understand what you mean here.</div></div></div></blockquote><div class=""><br class=""></div><div class="">I was a bit confused. Thanks to your clarification, I discovered that `rethrows` functions currently can use `throw` expression, but only in `catch` scope, which handles error handling for one of function parameters.</div><div class="">In my view, this language feature should be removed without replacement if we remove `rethrows`. Instead, we should always be able to throw error type stated in `throws(...)`.</div></div></div></div></div></blockquote><div><br class=""></div><div>I agree with this as long as all functions with an uninhabitable error type are treated as non-throwing.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I don’t understand what you mean here. In this alternative design *all* functions / closures / methods have an error type. If one is not stated explicitly it defaults to `Never`. If `throws` is specified without a type it defaults to `Error`. There is no burden at all placed on callers.</div></div></blockquote></div><br class=""></div><div class="gmail_extra">I meant that in that specific case I would prefer returning an optional. If error value is not meaningful--and that is the case with `f` function parameter and corresponding `F` error type--then we are dealing with simple domain errors, which are expressed with returning optionals instead of throwing. I'll include this example anyway.</div></div>
</div></blockquote></div><br class=""><div class="">You would still be able to return an Optional with no trouble. It would have an implicit error type of `Never` and a return type of `Optional`. This would be treated as a non-throwing function.</div></body></html>