<div dir="ltr"><div>Hi all,</div><div><br></div><div>Could someone please tell me why the following fails?</div><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">func foo(f: () throws -> () = {}) rethrows {</font></div><div><font face="monospace, monospace"> try f()</font></div><div><font face="monospace, monospace">}</font></div><div><br></div></div><div><div><font face="monospace, monospace">// Fine</font></div><div><font face="monospace, monospace">foo({ })</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// This fails with error:</font></div><div><font face="monospace, monospace">// call is to 'rethrows' function,</font></div><div><font face="monospace, monospace">// but a defaulted argument function can throw</font></div><div><font face="monospace, monospace">foo()</font></div><br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div></div></div></div></div></div></div></div>
<div>Why should I have to write "<span style="font-family:monospace,monospace">try foo()</span>", shouldn't it take the default value (non throwing closure)?</div><div><br></div><div>Regards,</div><div>Bhargav Gurlanka</div></div>