<div dir="ltr"><div>How to differentiate these functions?</div><div><br></div><div>class A{</div><div>    func someFunc(a: Int) -&gt; Int{</div><div>        return 0;</div><div>    }</div><div>    func someFunc(a: Int) -&gt; Double{</div><div>        return 0;</div><div>    }</div><div>    func someFunc(a: Double) -&gt; Int{</div><div>        return 0;</div><div>    }</div><div>    func someFunc(a: Double) -&gt; Double{</div><div>        return 0;</div><div>    }</div><div><div>   func someFunc(a: Int, b: Int) -&gt; Int{</div><div>        return 0;</div><div>    }</div></div><div>}</div><div><br></div><div>Even with backticks would not be possible.<br></div><div><br></div><div>You may need to reference the method signature altogether.</div><div><br></div><div>var someA = A()</div><div><b>let fn1 = someA.#someFunc(a: Int) -&gt; Int<br></b></div><b>let fn2 = someA.#someFunc(a: Int) -&gt; Double <br>let fn3 = someA.#someFunc(a: Double) -&gt; Int <br>let fn4 = someA.#someFunc(a: Double) -&gt; Double</b><div><br></div><div>An operator at the beginning perhaps?</div><div><br></div><div><div>let fn1 = #someA.someFunc(a: Int) -&gt; Int</div><div>let fn2 = #someA.someFunc(a: Int) -&gt; Double</div><div>let fn3 = #someA.someFunc(a: Double) -&gt; Int</div><div>let fn4 = #someA.someFunc(a: Double) -&gt; Double</div></div><div><br></div><div><div><br></div><div>You may not need the full signature all the time, only necessary to differentiate.</div></div><div><br></div><div><div>extension A {</div><div>    func someOtherFunc(a: Int, b: Int) -&gt; Int{</div><div>        return 0;</div><div>    }</div><div>    func someOtherFunc(){</div><div>    }</div><div>    func someOther(){</div><div>    }</div><div>}</div></div><div><br></div><div><div><b>let fn5 = someA.#someOtherFunc(a:, b:)</b></div><div><b>let fn6 = someA.#someOtherFunc()</b></div><div><b>let fn6 = someA.someOther</b></div></div><div><br></div><div>Another possibility:<br></div><div><br></div><div><div><b>let fn5 = #(someA.someOtherFunc(a:, b:))</b></div></div><div><div><b>let fn5 = @(someA.someOtherFunc(a:, b:))</b></div></div><div><b><br></b></div><div>Thus the parser can try to just focus on what&#39;s inside the <b>#(</b>...<b>) or </b><b>@(</b>...<b>)</b><br></div><div><br></div><div class="gmail_quote"><div dir="ltr">Em dom, 27 de dez de 2015 às 22:27, John McCall via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; On Dec 27, 2015, at 4:15 PM, Chris Lattner &lt;<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Dec 27, 2015, at 4:09 PM, John McCall &lt;<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>&gt; wrote:<br>
&gt;&gt;&gt; I’m a fan of good error recovery, but I don’t think it is a major concern here for two reasons:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1) The most common case in a method will lack a label, and &quot;thing.foo(_: “ and “thing.foo(:” are both unambiguously a curried reference.<br>
&gt;&gt;&gt; 2) A common case of accidentally completing a nullary call (thing.foo() vs thing.foo) will produce a type error.  We already produce good QoI for an unapplied function - adding the inverse would be simple.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Further, it will be uncommon *in general* to form a curried reference, so error recovery doesn’t have to be perfect in all the edge cases.  As with other commenters, if it is at all possible to avoid the extra backticks, I’d really prefer that.<br>
&gt;&gt;<br>
&gt;&gt; The concern, I think, is that a messed-up normal call might look like a curried reference.<br>
&gt;&gt;<br>
&gt;&gt; My inclination would be to go the other way: if we get a syntax for this that we like, I think we should use it for *all* curried member references, and reject things like foo.bar in favor of foo.`bar`.  The ability to write foo.bar for a method has always struck me as more clever than wise, to be honest.<br>
&gt;<br>
&gt; If you were to go that far, I’d suggest looking at this as a different version of the “.&quot; operator.  If you resyntax curried to something else like (just a strawman, intentionally ugly syntax):<br>
&gt;<br>
&gt;       foo.#bar<br>
&gt;<br>
&gt; Then you’d get a nice property that the plain old dot operator always has to be fully applied.  This certainly would be a win for error recovery.  Also, if you did this, you wouldn’t need the backticks from doug’s proposal either for things like:<br>
&gt;<br>
&gt;       foo.#bar(param1:param2:)<br>
&gt;<br>
&gt; either.<br>
<br>
Right.  I really like this effect.<br>
<br>
I’m not that bothered by requiring the backticks, especially because it generalizes well to non-member function references, which I’m not sure any sort of different-member-access syntax does.<br>
<br>
John.<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">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>
</blockquote></div></div>