<div dir="ltr">You can do this now. Since you can get a reference to the function you want by writing something like <span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="color:rgb(0,0,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"> function = </span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">subscribe</span><span style="color:rgb(0,0,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">(onNext:)</span>, you can do so and immediately call it:<br><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">struct</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> Event: </span><span style="font-variant-ligatures:no-common-ligatures">CustomStringConvertible</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> {</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">var</span><span style="font-variant-ligatures:no-common-ligatures"> description: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">String</span><span style="font-variant-ligatures:no-common-ligatures"> {</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(180,38,26)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">return</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span style="font-variant-ligatures:no-common-ligatures">&quot;an event&quot;</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">    }</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">func</span><span style="font-variant-ligatures:no-common-ligatures"> subscribe(onNext block: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">@escaping</span><span style="font-variant-ligatures:no-common-ligatures"> (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Event</span><span style="font-variant-ligatures:no-common-ligatures">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Void</span><span style="font-variant-ligatures:no-common-ligatures">)  {</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">    block(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Event</span><span style="font-variant-ligatures:no-common-ligatures">())</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">func</span><span style="font-variant-ligatures:no-common-ligatures"> subscribe(onError block: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">@escaping</span><span style="font-variant-ligatures:no-common-ligatures"> (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Event</span><span style="font-variant-ligatures:no-common-ligatures">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Void</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures">    </span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">func</span><span style="font-variant-ligatures:no-common-ligatures"> subscribe(onCompleted block: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">@escaping</span><span style="font-variant-ligatures:no-common-ligatures"> (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Event</span><span style="font-variant-ligatures:no-common-ligatures">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">Void</span><span style="font-variant-ligatures:no-common-ligatures">) {</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures">    </span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">subscribe</span><span style="font-variant-ligatures:no-common-ligatures">(onNext:) { event </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">in</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(180,38,26)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">print</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(</span><span style="font-variant-ligatures:no-common-ligatures">&quot;Subscribed to </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">\</span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">event</span><span style="font-variant-ligatures:no-common-ligatures">)&quot;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)">



















</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><div class="gmail_extra"><br></div><div class="gmail_extra">In a playground on Xcode 8.2.1, this prints “<b style="color:rgb(0,0,0);font-family:menlo;font-size:11px">Subscribed to an event</b>” in the console.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div style="font-family:helvetica"><br></div><div style="font-family:helvetica">Jeff Kelley</div><div style="font-family:helvetica"><br></div><div style="font-family:helvetica"><a href="mailto:SlaunchaMan@gmail.com" style="color:rgb(17,85,204)" target="_blank">SlaunchaMan@gmail.com</a> | <a href="https://twitter.com/SlaunchaMan" style="color:rgb(17,85,204)" target="_blank">@SlaunchaMan</a> | <a href="http://jeffkelley.org/" style="color:rgb(17,85,204)" target="_blank">jeffkelley.org</a></div></div></div></div>
<br><div class="gmail_quote">On Wed, Dec 28, 2016 at 11:58 PM, Nicholas Maccharoli 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)">Swift Evolution,</div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)">Swift&#39;s API Design Guidelines are really good in my opinion, but I believe there is </div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)">ambiguity with current trailing closure syntax.</div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)">Take for example if there were three variations of a `subscribe`function:</div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)">







<p class="gmail-m_-5786061952303709983gmail-p1"><span class="gmail-m_-5786061952303709983gmail-s1">     </span><span class="gmail-m_-5786061952303709983gmail-s2">func</span><span class="gmail-m_-5786061952303709983gmail-s1"> subscribe(onNext block: </span><span class="gmail-m_-5786061952303709983gmail-s2">@escaping</span><span class="gmail-m_-5786061952303709983gmail-s1"> (</span><span class="gmail-m_-5786061952303709983gmail-s3">Event</span><span class="gmail-m_-5786061952303709983gmail-s1">) -&gt; </span><span class="gmail-m_-5786061952303709983gmail-s4">Void</span><span class="gmail-m_-5786061952303709983gmail-s1">)  { ... }</span></p><p class="gmail-m_-5786061952303709983gmail-p1"><span class="gmail-m_-5786061952303709983gmail-s2">     func</span><span class="gmail-m_-5786061952303709983gmail-s1"> subscribe(onError block: </span><span class="gmail-m_-5786061952303709983gmail-s2">@escaping</span><span class="gmail-m_-5786061952303709983gmail-s1"> (</span><span class="gmail-m_-5786061952303709983gmail-s3">Event</span><span class="gmail-m_-5786061952303709983gmail-s1">) -&gt; </span><span class="gmail-m_-5786061952303709983gmail-s4">Void</span><span class="gmail-m_-5786061952303709983gmail-s1">) { ... }</span></p><p class="gmail-m_-5786061952303709983gmail-p2"><span class="gmail-m_-5786061952303709983gmail-s1"></span></p>
<p class="gmail-m_-5786061952303709983gmail-p2"><span class="gmail-m_-5786061952303709983gmail-s2">     func</span><span class="gmail-m_-5786061952303709983gmail-s1"> subscribe(onCompleted block: </span><span class="gmail-m_-5786061952303709983gmail-s2">@escaping</span><span class="gmail-m_-5786061952303709983gmail-s1"> (</span><span class="gmail-m_-5786061952303709983gmail-s3">Event</span><span class="gmail-m_-5786061952303709983gmail-s1">) -&gt; </span><span class="gmail-m_-5786061952303709983gmail-s4">Void</span><span class="gmail-m_-5786061952303709983gmail-s1">) { ... }</span><br><span class="gmail-m_-5786061952303709983gmail-s1"></span></p><p class="gmail-m_-5786061952303709983gmail-p2">Since using subscribe with trailing closure syntax would cause ambiguity:</p><p class="gmail-m_-5786061952303709983gmail-p2">     subscribe { event in ... } </p><p class="gmail-m_-5786061952303709983gmail-p2">The only option available is to call the function as normal:</p><p class="gmail-m_-5786061952303709983gmail-p2">     subscribe(onNext: { event in ... })</p><p class="gmail-m_-5786061952303709983gmail-p2">Since these functions are distinguished by their argument label, if a variation of trailing closure syntax were introduced that provided the option of using an argument label in parenthesis this ambiguity would disappear.</p><p class="gmail-m_-5786061952303709983gmail-p2">something like this:</p><p class="gmail-m_-5786061952303709983gmail-p2">     subscribe(onNext:) { event in ... }</p><p class="gmail-m_-5786061952303709983gmail-p2">would allow using trailing closure syntax in this case.</p><p class="gmail-m_-5786061952303709983gmail-p2">Just a thought, I personally think having this change to the language would be worthwhile but would love to hear the community&#39;s opinion. </p><p class="gmail-m_-5786061952303709983gmail-p2">- Nick <br></p><p class="gmail-m_-5786061952303709983gmail-p2"><br></p></div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:&#39;comic sans ms&#39;,sans-serif;color:rgb(39,78,19)"><br></div></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div></div>