<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sometimes they matter. Sometimes they don’t. You must believe in the former idea, or not be using Swift, but regardless of if you believe in the latter, the example that I showed compiles. Perhaps it only exists now for protocol conformance? I see it as a good place to start getting shorthand argument names integrated outside of closures.<div class=""><br class=""></div><div class="">I’ll chime back in when I find a good case, in production, for using external but not internal names. Most of the times that names don’t matter is in generic operator signatures.&nbsp;<br class=""><div class=""><br class=""></div><div class="">e.g. Here’s an operator I use (I saw something very similar recently called “then”).</div><div class=""><div class=""><br class=""></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(144, 45, 208);" class=""><div style="margin: 0px; line-height: normal;" class="">/// Useful for initializing something and doing&nbsp;</div><div style="margin: 0px; line-height: normal;" class="">/// things with it immediately thereafter.</div><div style="margin: 0px; line-height: normal;" class="">///</div><div style="margin: 0px; line-height: normal;" class="">///- <span style="font-variant-ligatures: no-common-ligatures; color: #009051" class="">Returns</span>: `$0`</div><div style="margin: 0px; line-height: normal;" class="">///</div><div style="margin: 0px; line-height: normal;" class="">/// Example:</div><div style="margin: 0px; line-height: normal;" class="">///```</div><div style="margin: 0px; line-height: normal;" class="">/// var instance = Type()…{</div><div style="margin: 0px; line-height: normal;" class="">///&nbsp; &nbsp; $0.property = newValue</div><div style="margin: 0px; line-height: normal;" class="">///&nbsp; &nbsp; $0.doSomething()</div><div style="margin: 0px; line-height: normal;" class="">/// }</div><div style="margin: 0px; line-height: normal;" class="">///```</div><div style="margin: 0px; line-height: normal;" class="">///- <span style="font-variant-ligatures: no-common-ligatures; color: #009051" class="">Remark</span>: Hold option, press ;</div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> …&lt;Type&gt;(</div><div style="margin: 0px; line-height: normal;" class="">&nbsp;&nbsp; _$0: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Type</span>,</div><div style="margin: 0px; line-height: normal;" class="">&nbsp;&nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">@noescape</span> ƒ0: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Type</span> -&gt; ()</div><div style="margin: 0px; line-height: normal;" class="">) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Type</span> {</div><div style="margin: 0px; line-height: normal;" class="">&nbsp;&nbsp; ƒ0(_$0)</div><div style="margin: 0px; line-height: normal;" class="">&nbsp;&nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> _$0</div><div style="margin: 0px; line-height: normal;" class="">}</div></div><div class=""><div class=""><br class=""></div><div class="">In the future, I’d prefer to keep the documentation the same, but have the code be this:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> …&lt;Type&gt;(Type, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">@noescape</span> Type -&gt; ()) {</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class="">&nbsp;&nbsp; ƒ0(.0)</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class="">&nbsp;&nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span>&nbsp;.0</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">1. The distinction between immutable closures and functions should dissolve, hence “let"&nbsp;</div><div class="">2. Trailing closures should be known by default as ƒ0, ƒ1, etc.</div><div class="">3. $ is ugly and should be changed to .</div><div class="">4. Return type should be implicit</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 4, 2016, at 3:26 AM, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">on Wed Feb 03 2016, Jessy Catterwaul &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class="">I’ve found that good external parameter names are typically just prepositions. <br class=""><br class="">Sometimes the noun that comes after the prepositions doesn’t benefit<br class="">from a real name. I’ve been naming those _$0 to minimize cognitive<br class="">load. (I don’t think about the name when writing, and when reading, I<br class="">know that the name would be useless to commit to my short-term<br class="">memory.)<br class=""><br class="">func move&lt;Point&gt;(to _$0: Point) {<br class=""> &nbsp;&nbsp;// argument is accessible as _$0<br class="">}<br class=""></blockquote><br class="">Try to write a documentation comment summary for this without mentioning<br class="">_$0. &nbsp;The parameter names actually matter.<br class=""><br class=""><blockquote type="cite" class="">Currently, this also compiles:<br class=""><br class="">func move&lt;Point&gt;(to _: Point) {<br class=""> &nbsp;&nbsp;// argument is inaccessible<br class="">}<br class=""><br class="">Is that useless? I think it’s useless but I might be missing something.<br class=""><br class="">I propose that, when external parameter names are used, but internal<br class="">ones use underscores, the arguments are accessible as $0, $1, etc. (I<br class="">use $0 a lot, and $1 a little, but have not yet needed $2,<br class="">personally.)<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></blockquote><br class="">-- <br class="">-Dave<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></div></div></div></body></html>