<div dir="ltr">Sorry, not keen. Too much overlap with labels, therefore not worth the addition.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 14 February 2016 at 07:38, Eugene Gubin 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 dir="ltr"><div>Right now Swift provides shorthand argument names ($0, $1 etc) by default which could be overriden with more specific names. I think it would be nice to define our own default names as part of type definition:<br></div><div><br></div><div>typealias Closure = (first one: String, second two: String) -&gt; Void</div><div><br></div><div>func executeClosure(closure: Closure) {</div><div><span style="white-space:pre-wrap">        </span>// the caller uses external parameter names, nothing changed here </div><div><span style="white-space:pre-wrap">        </span>closure(first: &quot;first&quot;, second: 2)</div><div>}</div><div><br></div><div>executeClosure {</div><div><span style="white-space:pre-wrap">        </span>// the callee uses custom arguments instead of $0, $1</div><div><span style="white-space:pre-wrap">        </span>// also it is possible to override these names here as usual </div><div><span style="white-space:pre-wrap">        </span>print(&quot;one \(one) two \(two)&quot;)</div><div>}</div><div><br></div><div>This feature is backward compatible in that way what both</div><div><br></div><div>typealias Closure = (first: String, second: String) -&gt; Void </div><div><br></div><div>and</div><div><br></div><div>typealias Closure = (String, String) -&gt; Void</div><div><br></div><div>will provide the same behavior like now.</div><div><br></div><div>Possible applications: providing default argument names more meaningfull than $0, $1, DSL-like constructions.</div><div><br></div><div>Possible problem: names could overlap. Nothing new. $0, $1 could overlap too. Override argument names or variable names in a scope.</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>