SE-0279: Multiple Trailing Closures [Amended]

+0.5
I read the proposal and also the Renaming Trailing-closure Functions in the Standard Library. But I will try not to off-topic here.

It’s kind of unfortunate the first labeled closure is omitted in the proposal.

As someone has already mentioned above that the label of the first closure is important in certain APIs and I’m doubted whether it’s possible to remove them all and put into function names.

I prefer first where: { ... } over firstWhere: { ... }.

And also the example Bind(get:set:) from @Lantua. How would you rename it if the first label is omitted? Abstract that by protocols seems too heavy to me.

But in some cases, omitting the first label is good and don’t harm readability.

Even from the teaching/learning perspective, I believe no special case is always a better choice. We have to learn how to use multiple closures anyway if the proposal is accepted. No matter how many closures a function takes, one or many, the first or the remaining, all follow the same rules.

To summarize my points, I think I would prefer a more balanced solution for the first labeled closure.

4 Likes