> On 24 Mar 2016, at 21:08, Howard Lovatt <howard.lov...@gmail.com> wrote:
>
> I use trailing closures all the time because I find the brackets too noisy,
> like ; at the end of a line is too noisy. The sort of code I use is:
>
> 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 })
While they may add a small amount of noise, in the latter case the parenthesis
clarifies that each is a method, and what all of its arguments are, and don’t
use any custom syntax. Of course this assumes that .reduce() would have an
optional label on its closure argument.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution