<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><blockquote type="cite" class=""><div class="">On Feb 22, 2017, at 12:24 PM, Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">There were some opinions on Slack that we should simply change `foo` so that it can *only* refer to the nullary version.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>I think this is the right solution. Eventually we want to get to the point where parameter labels are part of a compound name; at that point, it'd be natural for a zero-argument function to just have its name be the base name.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">That'd be a source-breaking change,</span></div></blockquote><div><br class=""></div><div>We can always support looking up members by base name only as an unprincipled shorthand. (But to tell the truth, I'd prefer to just break them.)</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">but I'm also not sure whether it's even solve the problem — is it true you might still have both a function and a variable named foo accessible in the same scope?</span></div></blockquote></div><div class=""><br class=""></div><div class="">The simple version is illegal:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Welcome to Apple Swift version 3.1 (swiftlang-802.0.41 clang-802.0.36). Type :help for assistance.<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> 1> struct X { var x: Int; func x() {} }<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>error: repl.swift:1:29: error: invalid redeclaration of 'x()'<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>struct X { var x: Int; func x() {} }<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> ^<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>repl.swift:1:16: note: 'x' previously declared here<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>struct X { var x: Int; func x() {} }<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span> ^<br class=""><br class=""></div><div class="">I have a sneaking suspicion there actually *are* circumstances where it's possible—but I think there probably shouldn't be.</div><div class=""><br class=""></div><div class="">Of the main options discussed—`foo(_)` vs `foo(:)`—I think the underscore is more accurate. It does conflict with pattern matching syntax, but I don't think you can match a (0-ary) function value against anything anyway, so I don't think that matters in practice.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">-- </div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>
</div>
<br class=""></body></html>