<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 11:41 AM, Anton Zhilin &lt;<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">2017-02-23 20:09 GMT+03:00 Matthew Johnson <span dir="ltr" class="">&lt;<a href="mailto:matthew@anandabits.com" target="_blank" class="">matthew@anandabits.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Feb 23, 2017, at 10:58 AM, Anton Zhilin &lt;<a href="mailto:antonyzhilin@gmail.com" target="_blank" class="">antonyzhilin@gmail.com</a>&gt; wrote:</div><br class="m_-2229157571309114331Apple-interchange-newline"><div class=""><div dir="ltr" class="">See some inline response below.<div class="">Also, have you seen the issue I posted in Proposal thread? There is a way to create an instance of "any" type.<br class=""></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Yes, I saw that.&nbsp; There is no problem with that at all.&nbsp; As I point out in the analysis below, rethrowing functions are allowed to throw any error they want.&nbsp; They are only limited by *where* they may throw.</div></div></div></blockquote><div class=""><br class=""></div><div class="">OK, if a function throws on itself (which is an unusual situation), it will state its semantics in documentation, and it's the right place to do that.</div></div></div></div></div></blockquote><div><br class=""></div><div>I don’t understand what you mean here.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class="h5"><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Yes, upcasting is only one way (besides others) to convert to a common error type. That's what I had in mind, but I'll state it more explicitly.<br class=""></div></div></div></div></blockquote></div></div><div class="">The important point is that if you include `rethrows` it should not place any restrictions on the type that it throws when its arguments throw.&nbsp; All it does is prevent the function from throwing unless there is a dynamic guarantee that one of the arguments did in fact throw (which of course means if none of them can throw then the rethrowing function cannot throw either).</div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, I understood that.&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Yes, any empty type should be allowed instead of just `Never`. That's a general solution to the ploblem with `rethrows` and multiple throwing parameters.</div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">It looks like you clipped out the section "Why this solution is better” which showed how `rethrows` is not capable of correctly typing a function as non-throwing if it dynamically handles all of the errors thrown by its arguments.&nbsp; What do you think of that?&nbsp; In my opinion, it makes a strong case for eliminating rethrows and introducing the uninhabited type solution from the beginning.</div></div></div></blockquote><div class=""><br class=""></div><div class="">I'm positive about baking removal of `rethrows` into the proposal.</div></div></div></div></div></blockquote><div><br class=""></div><div>Great!</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">The specific example seems superficial to me. Usually we want to require the bare minimum from the caller. But here we require a proper error type, which is never used. Although, it may just be a convenience overload, and the other overload accepts `() -&gt; Bool` or `() -&gt; Void?`.</div></div></div></div>
</div></blockquote></div><br class=""><div class="">I don’t understand what you mean here. &nbsp;In this alternative design *all* functions / closures / methods have an error type. &nbsp;If one is not stated explicitly it defaults to `Never`. &nbsp;If `throws` is specified without a type it defaults to `Error`. &nbsp;There is no burden at all placed on callers.</div><div class=""><br class=""></div></body></html>