# \[Accepted\] SE-0279: Multiple Trailing Closures

**URL:** <https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141>\
**Category:** Announcements\
**Created:** [May 4, 2020, 7:36pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141 "2020-05-04T19:36:07Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![DevAndArtist](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/devandartist/32/287_2.png) [@DevAndArtist](https://forums.swift.org/u/DevAndArtist)\
**Post date:** [May 5, 2020, 4:10pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/83 "2020-05-05T16:10:29Z")

</div>

Honestly, this should have been mentioned in the OP. If it already was, then it's too eloquently written for me not to understand that intent.

---

<div class="post-metadata">

**Author:** ![clayellis](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/clayellis/32/43646_2.png) [@clayellis](https://forums.swift.org/u/clayellis)\
**Post date:** [May 5, 2020, 4:12pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/84 "2020-05-05T16:12:44Z")

</div>

I'm concerned that we'll end up with a decent amount of breakage during/after the trial period, especially given that this proposal now encourages APIs to be designed knowing that the first label will be omitted. _Especially_ if work on this thread moves forward: [Renaming Trailing-closure Functions in the Standard Library](https://forums.swift.org/t/renaming-trailing-closure-functions-in-the-standard-library/35454)

---

<div class="post-metadata">

**Author:** ![Lantua](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lantua/32/8868_2.png) [@Lantua](https://forums.swift.org/u/Lantua)\
**Post date:** [May 5, 2020, 4:15pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/85 "2020-05-05T16:15:28Z")

</div>

> [@John\_McCall](#):
>
> I think we’d like to get some actual living experience with this design before considering a revision, but yes, it was intentional that we picked a design that can extended in that way in the future.

> [@clayellis](#):
>
> I'm concerned that we'll end up with a decent amount of breakage during/after the trial period

I'm afraid this could end up being very similar to [SE-0159 Fix Private Access Level](https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md). And that was pre-Swift 4.

---

<div class="post-metadata">

**Author:** ![filip-sakel](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/filip-sakel/32/8697_2.png) [@filip-sakel](https://forums.swift.org/u/filip-sakel)\
**Post date:** [May 5, 2020, 4:19pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/86 "2020-05-05T16:19:11Z")

</div>

I don’t think the Core Team’s decision is going to change by complaining about not taking community feedback more seriously into consideration. Don’t get me wrong, I’m also in favor of labeling the first-closure. With that said, let’s not forget that the Core Team is not some evil entity, they are developers like everyone here who helped build Swift, so there’s no need to doubt their intentions, they want what’s best for Swift as we all do.

I think this thread has taken way to much of our time and attention than it should have to. So, I believe we should work on solutions to optionally label first-closures as @Lantua put it (cause for better or for worse it’s their decision at the end).

---

<div class="post-metadata">

**Author:** ![anandabits](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/anandabits/32/355_2.png) [@anandabits](https://forums.swift.org/u/anandabits)\
**Post date:** [May 5, 2020, 4:22pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/87 "2020-05-05T16:22:20Z")

</div>

> [@clayellis](#):
>
> especially given that this proposal now encourages APIs to be designed knowing that the first label will be omitted. _Especially_ if work on this thread moves forward: [Renaming Trailing-closure Functions in the Standard Library](https://forums.swift.org/t/renaming-trailing-closure-functions-in-the-standard-library/35454)

This is a great point. The proposal as-is _encourages_ future source breaking proposals. Let's not kick that can down the road. If we're going to break source, let's [do this right](https://forums.swift.org/t/se-0279-multiple-trailing-closures-amended/35435/160).

If going prioritize source compatibility, the alternative of _optionally_ allowing a label for the first trailing closure eliminates the need to change existing API. Instead, we would get an _improvement_ to existing API: `first where: { ... }`, etc will be nicer to work with _as they already exist_.

We have two options that both seem far more reasonable than the accepted design. One is ideal and the other is source compatible. Neither would motivate followup proposals, particularly the _source breaking_ followup that the current design may encourage.

---

<div class="post-metadata">

**Author:** ![wowbagger](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wowbagger/32/13847_2.png) [@wowbagger](https://forums.swift.org/u/wowbagger)\
**Post date:** [May 5, 2020, 4:28pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/88 "2020-05-05T16:28:31Z")

</div>

Given the 6-month release cycle for minor Swift versions, and given that Swift 5.3 branch is already cut, I assume this proposal won't be implemented until 1 year later in Swift 5.4.

Even if a new proposal for amending this one is immediately reviewed and accepted as soon as Swift 5.4 is released, the amendment will be implemented at earliest in Swift 5.6, which will be 2 years from now.

How long does the "multiple trailing closures" feature have to stay in the current form, before the core team considers that there is enough "living experience"?

What if something like what has affected [SE-0057](https://forums.swift.org/t/update-on-se-0057/34246), [SE-0110, and SE-0155](https://forums.swift.org/t/update-on-se-0110-and-se-0155/33948) happens down the line, when more things are frozen and more restrictions are imposed on new proposals? Will an amendment for optionally adding the first label still be possible? In at least 2 years in the future?

By that time, there will be more people who have learnt Swift, and wouldn't more people take it as it is, and hold onto how it is because of "backward-compatibility"? Wouldn't this harm future Swift learners, because it IS an inconsistent style, and less likely to be changed as time goes on?

Why can't we just make it right, or as right as it can be in the first place, instead of waiting for years before being allowed an amendment that basically says "told you"?

---

<div class="post-metadata">

**Author:** ![wowbagger](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wowbagger/32/13847_2.png) [@wowbagger](https://forums.swift.org/u/wowbagger)\
**Post date:** [May 5, 2020, 4:32pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/89 "2020-05-05T16:32:29Z")

</div>

[Me, too](https://forums.swift.org/t/se-0279-multiple-trailing-closures-amended/35435/79).

Some others did as well, and received many "❤"s.

It shows it's not just an edge concern.

---

<div class="post-metadata">

**Author:** ![Spencer\_Kohan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spencer_kohan/32/4505_2.png) [@Spencer\_Kohan](https://forums.swift.org/u/Spencer_Kohan)\
**Post date:** [May 5, 2020, 4:32pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/90 "2020-05-05T16:32:43Z")

</div>

Honestly I have a hard time seeing why an optional argument label would not be the opptimal solution. I can understand in cases like `Binding` where you would really want it, but I think in a vast majority of cases where trailing closures are already used, it's just cleaner not to introduce another space-separated token at the call-site.

---

<div class="post-metadata">

**Author:** ![royhsu](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/royhsu/32/4589_2.png) [@royhsu](https://forums.swift.org/u/royhsu)\
**Post date:** [May 5, 2020, 4:35pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/91 "2020-05-05T16:35:32Z")

</div>

I think the restriction for the first closure of current proposal leads some apis to be designed in certain way. And they could become unreasonable once the Core Team decides we should lift up the restriction.

I can live fine with the current proposal under Swift 5.x. But it would be better if we could make multiple trailing closures even better when Swift 6+ comes.

BTW, naming apis is hard, with the restriction for first label, it makes namimg even harder to me.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [May 5, 2020, 4:38pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/92 "2020-05-05T16:38:14Z")

</div>

This proposal will be part of Swift 5.3, despite the branch already being cut. It's clear they want it for better SwiftUI code at WWDC next month. (For that matter, so will the final `@functionBuilder` work that was merged recently.) 5.4 is likely the first chance any changes could make it into the language, however.

---

<div class="post-metadata">

**Author:** ![anandabits](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/anandabits/32/355_2.png) [@anandabits](https://forums.swift.org/u/anandabits)\
**Post date:** [May 5, 2020, 4:39pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/93 "2020-05-05T16:39:29Z")

</div>

> [@Spencer\_Kohan](#):
>
> Honestly I have a hard time seeing why an optional argument label would not be the opptimal solution.

Many of us feel that if we were able to design from scratch the declaration and call site should be aligned. Existing API would need to explicitly elide the label with `_`. If that level of source breakage is unacceptable, then the optional argument label may be the best we can do. But it is not ideal.

---

<div class="post-metadata">

**Author:** ![wowbagger](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wowbagger/32/13847_2.png) [@wowbagger](https://forums.swift.org/u/wowbagger)\
**Post date:** [May 5, 2020, 4:41pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/94 "2020-05-05T16:41:03Z")

</div>

I thought the decision of accepting this proposal in the current form might have something to do with how close the WWDC is. I felt the thought cynical, and didn't mention it. But now I see I'm not the only one thinking it.

---

<div class="post-metadata">

**Author:** ![Rod\_Brown](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rod_brown/32/425_2.png) [@Rod\_Brown](https://forums.swift.org/u/Rod_Brown)\
**Post date:** [May 5, 2020, 4:55pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/95 "2020-05-05T16:55:27Z")

</div>

> [@filip-sakel](#):
>
> let’s not forget that the Core Team is not some evil entity, they are developers like everyone here who helped build Swift, so there’s no need to doubt their intentions, they want what’s best for Swift as we all do.

In all honesty, I think this is somewhat dismissive.

I don’t doubt the intentions for a great language. But there is also the other side of this: Swift is not run by the open source community. It is run by Apple, and their proprietary interests do come first above all.

How does this factor into decisions made about something so seemingly unimportant as this? Who knows. But look at the track record. Last year WWDC was used as a major feature announcement for swift features and then requested that the features be reviewed by Evolution afterwards. This took a large number of people aback as an attempt to “legitimise” a proprietary decision as one that had received independent feedback, despite the fact it had already been announced. Now, a month out from WWDC, we see a proposal pushed through for changes that had seemingly strong arguments in need of change, but there may be a strong organisational reason to get this in as is.

Ultimately, this is their right, and that’s fine. We all knew that by contributing we were asked for opinions, not for votes. But it begs the question what the point is of contributing when the arguments are strong in need of change, and things get pushed through anyway? Are Dub Dub slides more important than good process? While this may seem insulting to the team as a suggestion, looking at it from our perspective, that may indeed seem to be what happened here.

---

<div class="post-metadata">

**Author:** ![GetSwifty](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/getswifty/32/39108_2.png) [@GetSwifty](https://forums.swift.org/u/GetSwifty)\
**Post date:** [May 5, 2020, 5:05pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/96 "2020-05-05T17:05:15Z")

</div>

So I ignored the second round of discussion (and most of the first) due to the high amount of discussion but I just wanted to say I'm pretty happy with where this ended up for a few reasons:

1. It solves a problem I've been annoyed with for a long time
2. It's fully source compatible
3. It seems like the smallest amount of syntax needed while still feeling "Swifty" with named parameters

As to the first parameter being named, seems unwise since it would differ so much from the current Closure syntax. Also IMO it's ugly/weird with the typical closure syntax  
`func myAction(length: 5) completion: {`

Something that seems to be under-represented is it could be added, _but not removed_, later on. Once the feature gets out into the wild with real users there will be a much larger sampling of usage and any related frustrations. At that point if the first parameter label would improve things, it can be made optionally available. However if it were made optionally available now it would be a source breaking change to remove it, even if it turns out to not be useful to most users.

---

<div class="post-metadata">

**Author:** ![Jumhyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jumhyn/32/3891_2.png) [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Post date:** [May 5, 2020, 5:11pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/97 "2020-05-05T17:11:03Z")

</div>

Note that many here are arguing that it shouldn't be an _option_, but that if multiple trailing closures are used, every trailing closure _must_ have a label. This rule is not possible to add later in a source-compatible way (but, as with this proposal, the option to elide the label could be added in a follow-up proposal if usage shows that the difference between single and multiple trailing closure syntax causes friction/confusion).

---

<div class="post-metadata">

**Author:** ![GetSwifty](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/getswifty/32/39108_2.png) [@GetSwifty](https://forums.swift.org/u/GetSwifty)\
**Post date:** [May 5, 2020, 5:25pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/98 "2020-05-05T17:25:00Z")

</div>

> [@Rod\_Brown](#):
>
> what the point is of contributing when the arguments are strong in need of change, and things get pushed through anyway?

> [@wowbagger](#):
>
> the current form might have something to do with how close the WWDC is

Large corporations and conspiracy theories seem inseparable these days, but at least in this case there are some pretty good counterpoints.

1. The proposal had fairly large/meaningful changes between the first and second iteration that would have required significant work. If Apple had things depending on the feature/syntax, why would they "allow" such a large change?
2. The feature went through two _highly active_ and prolonged review periods. If they're in a rush to get this done...they're doing it wrong.
3. Probably the biggest counterpoint, Function Builders, a _core feature_ needed for SwiftUI, is still not officially in the language after being proposed almost a year ago. This shows that Apple is not waiting on Swift Evolution to build or release features _and_ the core team isn't pushing through proposals just because Apple wants them. If there are issues with a proposal, it's still iterated on and fixed regardless of when Apple ships their software.
4. Even ignoring the above reasons, WWDC is still a month away and their final software won't ship for (at least) an additional _three_ months. The Time where Apple would be pushing through evolution changes would be in August, not May.

---

<div class="post-metadata">

**Author:** ![Jumhyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jumhyn/32/3891_2.png) [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Post date:** [May 5, 2020, 5:32pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/99 "2020-05-05T17:32:02Z")

</div>

> [@GetSwifty](#):
>
> Even ignoring the above reasons, WWDC is still a month away and their final software won't ship for (at least) an additional _three_ months. The Time where Apple would be pushing through evolution changes would be in August, not May

Changes need to make it into the language version released with the first Xcode beta, and that syntax (ideally) will match all the WWDC slides, videos, and samples. In other words, right now _is_ the time that such changes would be important priorities.

---

<div class="post-metadata">

**Author:** ![Lantua](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lantua/32/8868_2.png) [@Lantua](https://forums.swift.org/u/Lantua)\
**Post date:** [May 5, 2020, 5:35pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/100 "2020-05-05T17:35:59Z")

</div>

In so far, I think there's no point in re-iterating the issues already raised during the review period. It seems they're already taken into consideration. Some may be misrepresented in the original announcement, which would be a valid follow up to make (and is a separated thing from the issue itself).

It's probably better that we think about how to continue with this, like a path to our _logical_ design, the _follow up proposal_, etc.

---

<div class="post-metadata">

**Author:** ![GetSwifty](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/getswifty/32/39108_2.png) [@GetSwifty](https://forums.swift.org/u/GetSwifty)\
**Post date:** [May 5, 2020, 5:54pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/101 "2020-05-05T17:54:07Z")

</div>

> [@Jumhyn](#):
>
> Changes need to make it into the language version released with the first Xcode beta

Yes-and that doesn't mean it needs to be an accepted proposal here. I believe Function Builders was shipped with Xcode 11 Beta1 before it even made it to pitch phase. It's also pretty normal for a brand new feature's syntax to change between WWDC and release. SwiftUI being one example, not to mention Swift itself.

It's certainly possible/likely Apple wanted this to go through so they would have time to integrate the changes, but there are enough counter examples of them not _pushing_ things through that it can't be taken as a given without additional evidence.

---

<div class="post-metadata">

**Author:** ![GetSwifty](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/getswifty/32/39108_2.png) [@GetSwifty](https://forums.swift.org/u/GetSwifty)\
**Post date:** [May 5, 2020, 5:59pm UTC](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141/102 "2020-05-05T17:59:22Z")

</div>

> [@GetSwifty](#):
>
> WWDC is still a month away

Make that [A month and a half](https://www.apple.com/newsroom/2020/05/apple-to-host-virtual-worldwide-developers-conference-beginning-june-22/) 😄

[Previous page](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141.md?page=4)

[Next page](https://forums.swift.org/t/accepted-se-0279-multiple-trailing-closures/36141.md?page=6)
