[swift-evolution] Deprecating Trailing Closures

Thorsten Seitz tseitz42 at icloud.com
Thu Mar 31 08:54:25 CDT 2016



Am 25.03.2016 um 13:44 schrieb Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org>:

>>>    let foo = myArray
>>>        .filter { $0 & 1 == 1 }
>>>        .map { $0 + 1 }
>>>        .reduce(0) { $0 + $1 }
>> 
>> This doesn’t really seem much neater or more readable to me than:
>> 
>>    let foo = myArray
>>        .filter({ $0 & 1 == 1 })
>>        .map({ $0 + 1 })
>>        .reduce(0, { $0 + $1 })
> 
> I, on the other hand, cannot imagine how you would not see a difference between the two. The paren-less form is *far* more readable to me; when you put a parenthesis and a curly bracket next to each other, the curly bracket disappears and I can no longer see that the expression is a closure.

Same for me!
 

> Swift generally doesn't mandate any particular style. I think this is a good time to continue that tradition.

Indeed.

-Thorsten 


More information about the swift-evolution mailing list