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

Derrick Ho wh1pch81n at gmail.com
Fri Feb 24 12:36:58 CST 2017


Does swift still use #?

foo(#)

It might be more obvious then

foo(_)

People might mistake it for foo(_:) if they are just glancing at it.

But foo(#) looks special.
On Thu, Feb 23, 2017 at 1:07 PM Vladimir.S via swift-evolution <
swift-evolution at swift.org> wrote:

> FWIW, I do think the foo(_) is the best variant. For me it means "no
> argument label AND no argument at all, as there is no `:` in it".
> foo(_:) means "no argument label BUT one argument". etc.
> As for `class()` IMO it is too cryptic. class(_) is more clear about what
> it *is*(because of _ as parameters, that symbol is not used when we call
> the func but used when we define a reference to it, like class(_:),
> class(_:something:)
>
> On 23.02.2017 17:36, Ben Rimmington via swift-evolution wrote:
> >
> >> 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
> >
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
> >
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170224/924cdcca/attachment.html>


More information about the swift-evolution mailing list