<div dir="ltr">I think the feature should stay but we need community guidelines on when and when not to use them.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">







<p><b><font color="#cc0000">___________________________________</font></b></p><p><b>James⎥Head Of CEO</b></p><p><b><font color="#cc0000"><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>⎥<a href="http://supmenow.com" target="_blank">supmenow.com</a></font></b></p><p><b><font size="2">Sup</font></b></p><p><b><font size="2">Runway East
</font></b></p><p><b><font size="2">10 Finsbury Square</font></b></p><p><b><font size="2">London</font></b></p><p><b><font size="2">
EC2A 1AF </font></b></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Mar 24, 2016 at 4:13 PM, William Dillon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<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"><span class=""><div><blockquote type="cite"><div>On Mar 24, 2016, at 7:18 AM, Kurt Werle via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr">Coming from ruby, I&#39;m quite fond of trailing closures.  I couldn&#39;t really give you a concrete reason why - putting them in the ()&#39;s really isn&#39;t that big a deal.  But I&#39;ll say that I move them outside every single time...<div><br></div><div>I will say that your examples are the most trivial possible and that the more complex the closure (describing context variables and return types, throws, etc) the uglier it seem to me to put it inside parens.</div></div><div class="gmail_extra"><br></div></div></blockquote></div><br></span><div>Agree.</div><div><br></div><div>Another thing I like about trailing closures is that it allows me to make custom constructs that feel more like a part of the language.  For example, I really love this extension for NSLock that I have:</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;;color:rgb(4,51,255)"><span>extension</span><span style="color:#000000"> </span><span style="color:#3495af">NSLock</span><span style="color:#000000"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>    </span><span style="color:#0433ff">func</span><span> protect(action: (</span><span style="color:#3495af">Void</span><span>) -&gt; </span><span style="color:#3495af">Void</span><span>) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>        </span><span style="color:#0433ff">self</span><span>.</span><span style="color:#3495af">lock</span><span>()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>        action()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>        </span><span style="color:#0433ff">self</span><span>.</span><span style="color:#3495af">unlock</span><span>()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>    }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>}</span></div></div><div><span><br></span></div><div><span>Now, whenever I need to use my lock, I can just do:</span></div><div><span><br></span></div><div><span><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;;color:rgb(52,149,175)"><div style="margin:0px;line-height:normal"><span>peersLock</span><span style="color:#000000">.</span><span>protect</span><span style="color:#000000"> {</span></div><div style="margin:0px;line-height:normal"><span>    outputString += </span><span style="color:#b4261a">&quot;</span><span>\</span><span style="color:#b4261a">(</span><span style="color:#0433ff">self</span><span>.</span><span>peers</span><span>.</span><span>count</span><span style="color:#b4261a">) peers:\n&quot;</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#0433ff">for</span><span> (</span><span style="color:#0433ff">_</span><span>, peer) </span><span style="color:#0433ff">in</span><span> </span><span style="color:#0433ff">self</span><span>.</span><span>peers</span><span> {</span></div><div style="margin:0px;line-height:normal"><span>        outputString += </span><span style="color:#b4261a">&quot;</span><span>\</span><span style="color:#b4261a">(</span><span>peer</span><span style="color:#b4261a">)\n&quot;</span></div><div style="margin:0px;line-height:normal"><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>    }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:&#39;Fira Code&#39;"><span>}</span></div><div><span><br></span></div></div></div><div><span>To me, it looks cleaner to me to not have this paren dangling around at the end.  On this one I’d definitely say that if you don’t like it, don’t use it.  I don’t *think* that you’re forced to use it anywhere.  It’s a hard sell to take it away from everyone.</span></div><div><span><br></span></div><div><span>- Will</span></div></div></span></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>