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

Vladimir.S svabox at gmail.com
Thu Feb 23 12:05:44 CST 2017


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
>


More information about the swift-evolution mailing list