<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">2017-02-19 22:59 GMT+03:00 Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>&gt;:</p>
<p style="margin:0px 0px 1.2em!important"></p><div class="markdown-here-exclude"><p></p><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>On Feb 19, 2017, at 1:32 PM, Anton Zhilin &lt;<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>&gt; wrote:</div><br class="m_-2614446803700265113Apple-interchange-newline"><div><div dir="ltr"><div class="m_-2614446803700265113markdown-here-wrapper"><p style="margin:0px 0px 1.2em!important">Now that I think about it, generic throws does not exactly cover <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">rethrows</code>.<br>Firstly, <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">rethrows</code> has semantic information that function itself does not throw—it would be lost.</p></div></div></div></blockquote></span>Can you elaborate further on what you mean by this?</div></div></blockquote><p></p></div><p style="margin:0px 0px 1.2em!important"></p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">protocol Default { init() }

func exec(f: () throws -&gt; Void) rethrows
{
    try f()
    throw MyError()  // error because of rethrows
}

func exec&lt;E&gt;(f: () throws(E) -&gt; Void) throws(E)
     where E: Error &amp; Default
{
    try f()
    throw E()  // okay
}
</code></pre><div title="MDH:PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9ImdtYWlsX3F1b3RlIj4yMDE3LTAy
LTE5IDIyOjU5IEdNVCswMzowMCBNYXR0aGV3IEpvaG5zb24gPHNwYW4gZGlyPSJsdHIiPiZsdDs8
YSBocmVmPSJtYWlsdG86bWF0dGhld0BhbmFuZGFiaXRzLmNvbSIgdGFyZ2V0PSJfYmxhbmsiPm1h
dHRoZXdAYW5hbmRhYml0cy5jb208L2E+Jmd0Ozwvc3Bhbj46PGJsb2NrcXVvdGUgY2xhc3M9Imdt
YWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjAgMCAwIC44ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mg
c29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PGRpdiBzdHlsZT0id29yZC13cmFwOmJyZWFrLXdvcmQi
PjxkaXY+PHNwYW4gY2xhc3M9IiI+PGJsb2NrcXVvdGUgdHlwZT0iY2l0ZSI+PGRpdj5PbiBGZWIg
MTksIDIwMTcsIGF0IDE6MzIgUE0sIEFudG9uIFpoaWxpbiAmbHQ7PGEgaHJlZj0ibWFpbHRvOmFu
dG9ueXpoaWxpbkBnbWFpbC5jb20iIHRhcmdldD0iX2JsYW5rIj5hbnRvbnl6aGlsaW5AZ21haWwu
Y29tPC9hPiZndDsgd3JvdGU6PC9kaXY+PGJyIGNsYXNzPSJtXy0yNjE0NDQ2ODAzNzAwMjY1MTEz
QXBwbGUtaW50ZXJjaGFuZ2UtbmV3bGluZSI+PGRpdj48ZGl2IGRpcj0ibHRyIj48ZGl2IGNsYXNz
PSJtXy0yNjE0NDQ2ODAzNzAwMjY1MTEzbWFya2Rvd24taGVyZS13cmFwcGVyIj48cC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