[swift-evolution] Standardize arguments in closures

João Nunes joao3001 at hotmail.com
Sat May 7 03:22:04 CDT 2016


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?


Sent from my iPhone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160507/14f23810/attachment-0001.html>

More information about the swift-evolution mailing list