<div dir="ltr">@Anton, Yes that would work and we would get typed throws, which I like. As an aside, I think E would have to be constrained to be an Error, `<E: Error>`, and maybe `throws<E>` reads better because you are used to types in angle brackets.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"> -- Howard.<br></div></div>
<br><div class="gmail_quote">On 13 January 2017 at 08:32, Anton Zhilin <span dir="ltr"><<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_6825551795680594501markdown-here-wrapper"><p style="margin:0px 0px 1.2em!important">The best way to deal with such situations should be typed throws. Then <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> should be removed and replaced with generics in <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">throws</code> clause. <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">E == Never</code> ⇔ function does not throw.</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-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">struct FStore<E> {
let f: () throws(E) -> Void
init(_ f: @escaping () throws(E) -> Void) { self.f = f }
func call() throws(E) { try f() }
}
let store = FStore<Never>({ print("Hello") })
store.call()
</code></pre><p style="margin:0px 0px 1.2em!important">[Phase2]</p>
<div title="MDH:VGhlIGJlc3Qgd2F5IHRvIGRlYWwgd2l0aCBzdWNoIHNpdHVhdGlvbnMgc2hvdWxkIGJlIHR5cGVk
IHRocm93cy4gVGhlbiBgcmV0aHJvd3NgIHNob3VsZCBiZSByZW1vdmVkIGFuZCByZXBsYWNlZCB3
aXRoIGdlbmVyaWNzIGluIGB0aHJvd3NgIGNsYXVzZS4gYEUgPT0gTmV2ZXJgwqDih5QgZnVuY3Rp
b24gZG9lcyBub3QgdGhyb3cuPGRpdj48YnI+PC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2PnN0cnVj
dCBGU3RvcmUmbHQ7RSZndDsgezwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9ImZvbnQtc2l6ZTogMTIu
OHB4OyI+Jm5ic3A7ICZuYnNwOyBsZXQgZjogKCkgdGhyb3dzKEUpIC0mZ3Q7IFZvaWQ8L3NwYW4+
PGJyIHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPjxzcGFuIHN0eWxlPSJmb250LXNpemU6IDEy
LjhweDsiPiZuYnNwOyAmbmJzcDsgaW5pdChfIGY6IEBlc2NhcGluZyAoKSB0aHJvd3MoRSkgLSZn
dDsgVm9pZCkgeyBzZWxmLmYgPSBmIH08L3NwYW4+PGJyIHN0eWxlPSJmb250LXNpemU6IDEyLjhw
eDsiPjxzcGFuIHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPiZuYnNwOyAmbmJzcDsgZnVuYyBj
YWxsKCkgdGhyb3dzKEUpIHsgdHJ5IGYoKSB9PC9zcGFuPjxicj48L2Rpdj48ZGl2PjxzcGFuIHN0
eWxlPSJmb250LXNpemU6IDEyLjhweDsiPn08L3NwYW4+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRp
dj5sZXQgc3RvcmUgPSBGU3RvcmUmbHQ7TmV2ZXImZ3Q7KHsgcHJpbnQoIkhlbGxvIikgfSk8L2Rp
dj48ZGl2PnN0b3JlLmNhbGwoKTwvZGl2PjxkaXY+YGBgPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRp
dj5bUGhhc2UyXTwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div></div>
</blockquote></div><br></div>