<div dir="ltr">On 14 November 2017 at 21:02, David Hart <span dir="ltr">&lt;<a href="mailto:david@hartbit.com" target="_blank">david@hartbit.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><span class="gmail-"><div><br></div></span>I’d be very hesitant to introduce this syntax:</div><div><br></div><div><ul class="gmail-m_2863118398544756606MailOutline"><li>it’s new syntax, so it comes with a complexity tax (it isn’t naturally obvious what it means for a func to be weak)</li><li>it’s only sugar for the capture of self</li></ul></div></div></blockquote><div>it might cover well over 90% of use cases (by my &quot;pessimistic&quot; estimate)... if someone has a quick way to scan and analyse, say, github swift sources we may even know that current percentage number of real life usage.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><ul class="gmail-m_2863118398544756606MailOutline"><li>it doesn’t transpose well to local closures</li></ul></div></div></blockquote><div><br></div><div>the last one - maybe not. follow me:</div><div><br></div><div>let closure = { [weak self, bar] in ... }</div><div><br></div><div>which today can be written as: <br></div><div><br></div><div>let closure = { [weak self, bar] () -&gt; Int in ... } // full form</div><div><br></div><div>or as:</div><div><br></div><div><div>let closure: () -&gt; Int = { [weak self, bar] in ... } // full form</div></div><div><br></div><div><div>which allows this change:<br></div></div><div><br></div><div>let closure:  [weak self, bar] () -&gt; Int = { ... } // full alt form</div><div><br></div><div>or in alternative form:</div><div><br></div><div><div>let closure:  weak () -&gt; Int = { [bar] in ... } // short hand form</div></div><div><br></div><div>same can be with functions:</div><div><br></div><div>func fn() -&gt; Int { [weak self, bar] in ... } // full form</div><div><br></div><div>weak func fn() -&gt; Int { [bar] in ... } // short hand form</div><div><br></div><div>the two capture attributes will in practice be &quot;close&quot; to each other:</div><div><br></div><div><div>weak func fn() {</div><div>    [bar] in</div><div>    ....</div><div>}</div></div><div><br></div><div>and in majority of cases there will be only weak self:</div><div><br></div><div><div>weak func fn() {</div><div>    ....<br></div><div>}</div></div><div><br></div><div>Mike</div><div><br></div></div></div></div>