foo(_) seems better.  A colon would imply there is an argument of which there is none.<br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 22, 2017 at 4:52 AM Patrick Pijnappel via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">I&#39;m personally in favor of <font face="monospace, monospace" class="gmail_msg">foo(_)</font>, as the number of colons currently lines up directly with the number of arguments, and it&#39;d be good to keep it that way.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">In general though I&#39;m very in favor of requiring the parentheses, as the ambiguity between unparenthesized references to functions and properties can be quite confusing/annoying.</div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg">On Wed, Feb 22, 2017 at 6:35 PM, David Hart via swift-evolution <span dir="ltr" class="gmail_msg">&lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div id="m_-4936719881631257238m_7995815828843001064m_-1771258588154260740AppleMailSignature" class="gmail_msg"><span class="gmail_msg"><blockquote type="cite" class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg">On 22 Feb 2017, at 08:05, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg"></span></font></blockquote><blockquote type="cite" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Evolutioniers,</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><b class="gmail_msg">Compound name syntax</b> — foo(_:), foo(bar:), foo(bar:baz:) — is used to disambiguate references to functions. (You might&#39;ve used it inside a #selector expression.) But there&#39;s currently no compound name for a function with no arguments.</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">    func foo() {}  // no compound syntax for this one :(</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">    func foo(_ bar: Int) {}  // foo(_:)</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">    func foo(bar: Int) {}  // foo(bar:)</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">    func foo(bar: String, baz: Double) {}  // foo(bar:baz:)</span></font></div></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Given these four functions, only the first one has no compound name syntax. And the simple reference &quot;let myfn = foo&quot; is ambiguous because it could refer to any of the four. A workaround is to specify a contextual type, e.g. &quot;let myfn = foo as () -&gt; Void&quot;.</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">I filed <a href="https://bugs.swift.org/browse/SR-3550" class="gmail_msg" target="_blank">SR-3550</a> for this a while ago, and there was some discussion in JIRA about it. I&#39;d like to continue exploring solutions here and then write up a formal proposal.</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">To kick off the discussion, <b class="gmail_msg">I&#39;d like to propose foo(:) for nullary functions.</b></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Advantages:</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">- the colon marks a clear similarity to the foo(bar:) form when argument labels are present.</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">- cutely parallels the empty dictionary literal, [:].</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Disadvantages:</span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">- violates intuition about one-colon-per-argument.</span></font></div></div></blockquote><div class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></div></span><div class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">This is a big disadvantage for me and will potentially be very surprising for newcomers.</span></div><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span><blockquote type="cite" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">- the parallel between #selector(foo(:))and @selector(foo) is not quite as obvious as between #selector(foo(_:))and @selector(foo:).</span></font></div><span class="gmail_msg"><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></font></div><div class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">For the sake of discussion, another option would be <b class="gmail_msg">foo(_)</b>. This was my original choice, and I like that the number of colons matches the number of parameters. However, it&#39;s a little less obvious as a function reference. It would preclude _ from acting as an actual identifier, and might conflict with pattern-matching syntax (although it appears functions can&#39;t be compared with ~= anyway).</span></font></div></span></div></blockquote><div class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">This is my favorite syntax so far.</span></div><span class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg"><br class="gmail_msg"></span><blockquote type="cite" class="gmail_msg"><div dir="ltr" class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Looking forward to everyone&#39;s bikeshed color ideas,<br clear="all" class="gmail_msg"></span></font><div class="gmail_msg"><div class="m_-4936719881631257238m_7995815828843001064m_-1771258588154260740gmail_signature gmail_msg"><div dir="ltr" class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">Jacob<br class="gmail_msg"></span></font></div></div></div></div></blockquote></span><blockquote type="cite" class="gmail_msg"><font color="#000000" class="gmail_msg"><span style="background-color:rgba(255,255,255,0)" class="gmail_msg">_______________________________________________<span class="gmail_msg"><br class="gmail_msg">swift-evolution mailing list<br class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></span></font></blockquote></div></div><br class="gmail_msg">_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div></div>
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>