[swift-evolution] [Proposal draft #2] Naming Functions with Argument Labels
Douglas Gregor
dgregor at apple.com
Tue Jan 12 01:43:49 CST 2016
Sent from my iPhone
On Jan 11, 2016, at 11:22 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>>> foo(bar:(Int))
>>> (that's why I wanted to avoid the parenthesis in the first place…)
>>
>> It’s grammatically ambiguous if you don’t have the “:)” at the end
>
> Is it? It's not legal to pass a type name—`foo(bar: Int)` is not legal code; you have to say `foo(bar: Int.self)`.
"Grammatically" is key here: the parser doesn't know a type name from a variable name.
> --
> Brent Royal-Gordon
> Architechies
>
More information about the swift-evolution
mailing list