<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=""><div class="">Corrections, additions below…</div><br class=""><div><blockquote type="cite" class=""><div class="">Let's consider the following declarations:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><div class=""><span class="" style="font-family: Menlo; font-size: 11px;"> </span><b class="" style="font-family: Menlo; font-size: 11px;">class</b><span class="" style="font-family: Menlo; font-size: 11px;"> Bar {</span></div></div><div class=""><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> </span><b style="font-family: Menlo; font-size: 11px;" class="">func</b><span style="font-family: Menlo; font-size: 11px;" class=""> baz() </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// #8 Method named '</span><b style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">Bar.baz(_)</b><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">' with type '<b class="">Bar -> () -> ()</b>'.</span></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> </span><b style="font-family: Menlo; font-size: 11px;" class="">func</b><span style="font-family: Menlo; font-size: 11px;" class=""> baz(x y: Int) </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// #9 Method named '</span><b style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">Bar.baz(x:)</b><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">' with type '<b class="">Bar -> Int -> ()</b>'.</span></div><div class=""><span style="font-size: 11px; font-family: Menlo;" class=""> </span><span style="font-size: 11px; font-family: Menlo;" class=""> </span><b style="font-size: 11px; font-family: Menlo;" class="">static func</b><span style="font-size: 11px; font-family: Menlo;" class=""> </span><span style="font-size: 11px; font-family: Menlo;" class="">baz(x: Int = 0) </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// #10 Static method named '</span><b style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">Bar.Self.baz(x:)</b><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">' with type '<b class="">Int -> ()</b>'.</span></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> }</span></div></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> </span><span class="" style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;">// ...</span></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> <b class="">let</b> bar = Bar()</span></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> </span></font><font color="#ff2600" face="Menlo" style="font-size: 11px;" class=""><b class="">let</b> f10 = bar.baz</font><font face="Menlo" class=""><span style="font-size: 11px;" class=""> </span></font><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// <b class="">error:</b> not a function reference, did you mean 'bar.baz(_)' or 'bar.baz(x:)'?</span></div><div class=""><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> <b class="">let</b> f11 = bar.baz(_) </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// #18 Function synonymous to the closure '{ bar.baz() }' with type '<b class="">() -> ()</b>'.</span></div></div><div class=""><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> <b class="">let</b> f12 = bar.baz(x:) </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">// #19 Function synonymous to the closure '{ bar.baz(x: $0) }' with type '<b class="">Int -> ()</b>'.</span></div></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> let f13 = Bar.Self.baz(x:) </span></font><font color="#919191" face="Menlo" style="font-size: 11px;" class="">// #20 Function synonymous to the closure '{ Bar.baz(x: $0) }' with type '</font><b style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">Int -> ()</b><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">'.</span></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> let f14 = Bar.Self.baz(_) </span></font><font color="#919191" face="Menlo" style="font-size: 11px;" class="">// #21 Function synonymous to the closure '{ Bar.baz() }' with type '<b class="">() -> ()</b>'.</font></div></div></div></blockquote><div><br class=""></div><div>(…)</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">C2: Extend <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md" class="">SE-0021</a> by <b class="">removing</b> the ambiguity between instance and type members. From now on, `Bar.baz(_)` </div></div></div></blockquote><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div></div></blockquote><div><br class=""></div><div>That was meant to read:</div><div><br class=""></div><div></div><div>"(…) From now on, `<font face="Menlo" class=""><span style="font-size: 11px;" class="">Bar.baz(_)</span></font>` unambiguously refers to the <i class="">instance</i> method named `<font face="Menlo" class=""><span style="font-size: 11px;" class="">baz(_)</span></font>`. To refer to the static or class method named `<font face="Menlo" class=""><span style="font-size: 11px;" class="">baz(_)</span></font>`, put the keyword `<font face="Menlo" class=""><span style="font-size: 11px;" class="">.<b class="">Self</b></span></font>` between the type and the base name. This syntax should align with the outcome of <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0068-universal-self.md" class="">SE-0068</a> such the keyword resembles the static method call `thing<font face="Menlo" class=""><span style="font-size: 11px;" class="">.<b class="">Self</b>.baz()</span></font>` of a `<font face="Menlo" class=""><span style="font-size: 11px;" class="">thing</span></font>` of type `<font face="Menlo" class=""><span style="font-size: 11px;" class="">Bar</span></font>`."</div><div><br class=""></div><div>(Alternatives considered: (1) the use of `Bar.self.baz(_)` with lower-case `<font face="Menlo" class=""><span style="font-size: 11px;" class="">self</span></font>`, which is probably more confusing; and (2) inverting the choice and making the instance method require a keyword instead, which would harm readability as it's usually the instance method that you'd refer to and not the static one.)</div><br class=""><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">C6: <b class="">Clarify</b> that by using the base name `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo</span></font>` for a function, the same scope cannot define a variable with the name `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo</span></font>`. And, vice versa, in a scope that defines a variable named `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo</span></font>`, there can be no function `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo(...)</span></font>` defined at the same scope level.</div><div class=""></div></div></blockquote><div><br class=""></div><div>This doesn't prevent shadowing of course. E.g. An inner scope with a variable named `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo</span></font>` would shadow all functions named `<font face="Menlo" class=""><span style="font-size: 11px;" class="">foo(...)</span></font>` of an enclosing scope.</div><br class=""><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">The implications are:</div><div class=""><br class=""></div><div class="">I1: The use of a function's base name to refer to a function will cease to work. It has, however, been buggy up to this date. Consider the following:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> <b class="">let</b> f = [Int].prefix </span><font color="#919191" style="font-size: 11px;" class="">// '[Int] -> Int -> ArraySlice<Int>'</font></font></div><div class=""><font face="Menlo" class=""><font color="#919191" style="font-size: 11px;" class=""><br class=""></font></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> <b class="">let</b> g1 = [Int].dropFirst </span><font color="#919191" style="font-size: 11px;" class="">// Inexplicably chooses the '[Int] -> Int -> ArraySlice<Int>' overload!</font></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> <b class="">let</b> g2 = [Int].dropFirst <b class="">as</b> [Int] -> () -> ArraySlice<Int> </span></font><font color="#919191" face="Menlo" style="font-size: 11px;" class="">// Disambiguate</font><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class=""> </span><span style="color: rgb(145, 145, 145); font-family: Menlo; font-size: 11px;" class="">by type</span><span style="font-size: 11px; color: rgb(145, 145, 145); font-family: Menlo;" class="">.</span></div><div class=""><font color="#919191" face="Menlo" style="font-size: 11px;" class=""><br class=""></font></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""> <b class="">let</b> h1 = [Int].sorted </span><font color="#919191" style="font-family: Menlo; font-size: 11px;" class="">// Chooses the '[Int] -> () -> [Int]' overload, unlike 'dropFirst' above.</font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""> </span></font><b style="font-family: Menlo; font-size: 11px;" class="">let</b><font face="Menlo" class=""><span style="font-size: 11px;" class=""> h2 = [Int].sorted <b class="">as</b> [Int] -> ((Int, Int) -> Bool) -> [Int] </span></font><font color="#919191" face="Menlo" style="font-size: 11px;" class="">// Disambiguate by type.</font></div></div></div></blockquote><div><br class=""></div><div>By the way, the same also happens with the current Swift (both 2.2 and 3 master) when referring to the partially applied instance method like so:</div><div><br class=""></div><div><div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><span class="" style="font-family: Menlo; font-size: 11px;"> <b class="">let</b> xs = [1,3,2]</span></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px;"> <b class="">let</b> g = xs.dropFirst </span><font color="#919191" class="" style="font-family: Menlo; font-size: 11px;">// Chooses the 'Int -> ArraySlice<Int>' overload.</font></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px;"> <b class="">let</b> h = xs.sorted </span><font color="#919191" class="" style="font-family: Menlo; font-size: 11px;">// Chooses the '() -> [Int]' overload, unlike 'dropFirst' above.</font></div><div class=""><br class=""></div></div></div></div></div><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I3: Function argument lists are no longer that special and there's no need to notate single-n-tuple argument lists separately from n-argument functions, i.e. <b class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0066-standardize-function-type-syntax.md" class="">SE-0066</a> is not really needed anymore</b>. The new intuition here is that <b class="">it's the function's name that defines how a function can be called</b>, not its type.</div><div class=""></div></div></blockquote><div><br class=""></div><div>In yet other words, <b class="">we don't have to capture the arity of a function in the type system at all</b>—it's enough to carry that information around in the function name.</div><br class=""></div><div>~></div><div><br class=""></div><div>Finally, this was a fairly technical pitch but a pitch anyway. Any ideas pro or against?</div><br class=""><div class="">— Pyry</div><div class=""><br class=""></div></body></html>