> On 25 Mar 2016, at 08:10, Haravikk via swift-evolution
> <swift-evolution@swift.org> wrote:
>
>
>> 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.
On the other hand, I find the addition of the parenthesis makes it less
readable than the one without. So please don't assume that what is equally
readable for you applies to everyone else.
Alex
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution