[swift-evolution] [Review] SE-0066: Standardize function type argument syntax to require parentheses

Vladimir.S svabox at gmail.com
Tue Apr 26 07:56:08 CDT 2016


On 26.04.2016 9:38, Goffredo Marocchi via swift-evolution wrote:
 >
 > Agreed, the exception for the parameter list in a closure declaration
 > should be gone too potentially, I do not see a very convincing case why we
 > should keep it. Does it solve some particular problem now in its current 
form?

Probably support. If we want to be clear about if parameter list is a tuple 
or it is a list of values i.e. (Int,Int) -> Void  vs  ((Int,Int)) -> Void , 
IMO we should be also clear about parameter list in a closure declaration..

But it seems right now it is not just about syntax:

func z1(block: (Int,Int) -> Void) {
     block(1,2)
}

z1 { x, y in print(x,y)} // ok
z1 { x in print(x.0, x.1)} // what??
z1 { (x, y) in print(x, y)} // .. probably ok..

func z2(block: ((Int,Int)) -> Void) {
     block((1,2))
}

z2 { x, y in print(x,y)}   // why ??
z2 { x in print(x.0, x.1)} // ok
z2 { (x, y) in print(x, y)} // hm.. ?
//z2 { ((x, y)) in print(x, y)}  // compilation error



More information about the swift-evolution mailing list