<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-02-23 20:09 GMT+03:00 Matthew Johnson <span dir="ltr"><<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Feb 23, 2017, at 10:58 AM, Anton Zhilin <<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>> wrote:</div><br class="m_-2229157571309114331Apple-interchange-newline"><div><div dir="ltr">See some inline response below.<div>Also, have you seen the issue I posted in Proposal thread? There is a way to create an instance of "any" type.<br></div></div></div></blockquote><div><br></div></span><div>Yes, I saw that. There is no problem with that at all. As I point out in the analysis below, rethrowing functions are allowed to throw any error they want. They are only limited by *where* they may throw.</div></div></div></blockquote><div><br></div><div>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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>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></div></div></div></div></blockquote></div></div><div>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. 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><br></div><div>Yes, I understood that. </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"><div><span class=""><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>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><br></div></span><div>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. What do you think of that? 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><br></div><div>I'm positive about baking removal of `rethrows` into the proposal.</div><div>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 `() -> Bool` or `() -> Void?`.</div></div></div></div>