Standardize arguments in closures


(Joao Nunes) #1

Hello,

In the light of this proposal https://github.com/apple/swift-evolution/blob/master/proposals/0066-standardize-function-type-syntax.md

I suggest to do similar for closure arguments.

Right now we can define our closure arguments in 3 ways:

let closure: (String) -> Int = {
  value -> Int in
  return 0
}

let closure2: (String) -> Int = {
  (value) -> Int in
  return 0
}

let closure3: (String) -> Int = {
  (value:String) -> Int in
  return 0
}

The first version, could be abolished in light of the above proposal. It would avoid confusion and improve the learning curve. The 1st example doesn't allow either to add the type as we did in example 3.

What are your thoughts?

João

···

Sent from my iPhone