[swift-evolution] [Proposal draft #2] Naming Functions with Argument Labels

Brent Royal-Gordon brent at architechies.com
Tue Jan 12 01:52:56 CST 2016


>>> 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. 

Okay, but is it important to distinguish the two grammatically? A function call and a function reference are both expressions and can (types aside) both be used in the same places, right?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list