[swift-evolution] Pitch: Compound name `foo(:)` for nullary functions

Jacob Bandes-Storch jtbandes at gmail.com
Thu Feb 23 13:38:59 CST 2017

This is clean, but given knowledge of foo(bar:) syntax, its discoverability
is low. Conversely, given knowledge of `foo()`, the discoverability of
foo(bar:) would be low compared to `foo(bar:)`.

If backticks were the *only* option, and also worked as `foo(bar:)`, the
consistency would be appealing. Although then if you had a function name
which needed backticks,  `foo`(bar:) would have to continue working, I
suppose, so only allowing `foo(bar:)` isn't feasible.

I imagine this would make for some very nice code completion, though —
`foo(#^...^#  could suggest the names of all the foo variants.

On Thu, Feb 23, 2017 at 6:36 AM, Ben Rimmington <me at benrimmington.com>

> > On 23 Feb 2017, at 14:23, Xiaodi Wu wrote:
> >
> > What happens when you need the backticks for the function name itself?
> We can't nest them.
> func `class`() {}
> `class`() // Function call.
> `class()` // Function reference.
> -- Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170223/2923c0b6/attachment.html>

More information about the swift-evolution mailing list