[swift-evolution] Why doesn't Swift allow a variable and a function with the same name?
xiaodi.wu at gmail.com
Mon Jan 30 22:14:25 CST 2017
Just left a comment on the bug; it's clear we need some sort of new syntax,
and I'd like to throw out `foo(:)` as a candidate, by analogy with `[:]`
being an empty dictionary.
On Mon, Jan 30, 2017 at 22:04 Jacob Bandes-Storch via swift-evolution <
swift-evolution at swift.org> wrote:
> You said "The ability to reference a function by only the first segment of
> its name is likewise legacy of the original model..." — how else could you
> refer to a nullary function? Even if labels were required for naming
> (>0)-ary functions, there's still ambiguity between a nullary function and
> a variable.
> On Mon, Jan 30, 2017 at 7:54 PM Joe Groff <jgroff at apple.com> wrote:
> > On Jan 30, 2017, at 7:34 PM, Jacob Bandes-Storch <jtbandes at gmail.com>
> > Although there's no spelling for this...
> IMO, the way to spell `foo` with no arguments is just `foo`. If we
> strictly required the labels for referring to n-ary functions, that would
> make it unambiguous…
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution