<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 28 Apr 2016, at 14:37, Tino Heth &lt;<a href="mailto:2th@gmx.de" class="">2th@gmx.de</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">C1: Extend&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md" class="">SE-0021</a>&nbsp;by&nbsp;<b class="">adding</b>&nbsp;the underscore-in-parentheses syntax `<font face="Menlo" class=""><span class="" style="font-size: 11px;">foo(_)</span></font>` to refer to the zero-argument function #1.</blockquote><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I don't think that's consistent with the other use cases of the underscore: Afair, it never means "nothing", but always "there is something, but ignore it"</span></div></div></div></blockquote></div><br class="">
Right, that was another choice I forgot to justify:<div class=""><br class=""></div><div class="">We already refer to `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">func</b> foo(_ x: Int, _ y: Int)</span></font>` as `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo(_:_:)</span></font>` even if the function call only contains a comma and no colons nor underscores. Yes, `<font face="Menlo" class=""><span style="font-size: 11px;" class=""><b class="">func</b> foo()</span></font>` neither has an underscore in the definition. But we need something to distinguish its from the function call `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo()</span></font>`, so `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo(_)</span></font>` is an honest attempt to stick to the existing SE-0021 practice.</div><div class=""><br class=""></div><div class="">Personally, I'm fine with the syntax introduced by SE-0021 and I'd rather keep its criticism out of this thread if possible.</div><div class=""><br class=""></div><div class="">However, we could consider the alternative that you proposed where `foo` alone may only refer to the zero-argument function and for everything else, the argument list is always required.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">(…) so unless I didn't miss any downsides of using square brackets, (…)</blockquote><blockquote type="cite" class=""><br class=""></blockquote><blockquote type="cite" class="">let f = foo</blockquote><blockquote type="cite" class="">let f = foo[x: Int]<br class=""></blockquote><blockquote type="cite" class="">let f = foo[Int]<br class=""></blockquote><blockquote type="cite" class="">let f = foo[(Int, Int)]</blockquote><blockquote type="cite" class="">let f = foo[x: Int, y: Int]</blockquote><blockquote type="cite" class="">let f = foo[x: Int, y: Int]<br class=""></blockquote><br class=""></div><div class="">The square brackets do avoid the ambiguity too but FWIW, they look foreign to me. It's also pretty noisy having to spell out all the argument types (unless you meant that it's optional doing so). In the majority of cases, there is no overloading by type, or if there is then the type can be inferred at the point of use.</div><div class=""><br class=""></div><div class="">— Pyry</div><div class=""><br class=""></div></body></html>