# \[Accepted\] SE-0481: \`weak let\`

**URL:** <https://forums.swift.org/t/accepted-se-0481-weak-let/79895>\
**Category:** Announcements\
**Tags:** weak\
**Created:** [May 14, 2025, 6:22pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895 "2025-05-14T18:22:04Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [May 14, 2025, 6:22pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/1 "2025-05-14T18:22:04Z")

</div>

Hello, Swift community.

The [review](https://forums.swift.org/t/se-0481-weak-let/79603) of [SE-0481: `weak let`](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0481-weak-let.md) ran from April 30th through May 13th, 2025.

Feedback was generally positive.

Some reviewers expressed concern about a perceived shift in the meaning of `let` that allows the "mutation" of the `weak` reference becoming `nil`. The Language Steering Group is satisfied with the explanation in the proposal that the weak reference itself remains constant, and it's simply that the act of observing it will begin to yield `nil` after the referent is destroyed. The fact (as pointed out in the review) that `weak var`s do not trigger the observing `willSet` / `didSet` accessors when they become `nil` is also consistent with this way of understanding weak references. The LSG further notes that the mutability story of `let` in complex cases was recently complicated by the introduction of [atomic values](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0410-atomics.md#interaction-with-existing-language-features) and [mutexes](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0433-mutex.md#interaction-with-existing-language-features), which must be declared with `let`, although we believe `weak let` can be more simply understood.

There was some discussion in the review about `let` property wrappers and computed `let` properties. The LSG does not see any reason to hold up or complicate this feature, where the interpretation of `let` is natural and immediately useful, over potential changes to other features. Community members interested in these ideas should pitch them separately.

Accordingly, SE-0481 is **accepted**.

As always, I'd like to thank the reviewers for their contributions; participating in open review is a key part of making Swift a better language.

John McCall  
Review Manager

---

<div class="post-metadata">

**Author:** ![vanvoorden](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/vanvoorden/32/33619_2.png) [@vanvoorden](https://forums.swift.org/u/vanvoorden)\
**Post date:** [May 14, 2025, 6:49pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/2 "2025-05-14T18:49:06Z")

</div>

> [@\`nonisolated lazy let\` on an actor](https://forums.swift.org/t/nonisolated-lazy-let-on-an-actor/63077):
>
> I've been toying around with an idea to reverse the polarity of nesting an actor into a @MainActor protected class with the ability to hide the class object. There are some additional goals here: the actor could be initialized from anywhere, so its init is nonisolated by default there should be no reference cycle between the parent and child objects the init should not fallback to become async we should be able to expose the access to the nested @MainActor protected object through non-async …

~~By any chance do we know if `nonisolated lazy let` will be possible? Or will that need to be a compiler error similar to `nonisolated lazy var`?~~

Ahh… maybe I misread the proposal… looks like this would be a different direction for another day maybe.

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [May 14, 2025, 6:58pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/3 "2025-05-14T18:58:27Z")

</div>

I don't really see the connection to SE-0481, but I'll try to answer it. A `lazy var` instance property of an actor cannot be safely `nonisolated` both because the lazy-initialization sequence is not thread-safe and because it is a mutable variable. `lazy let` would address the latter but not the former. The lazy-initialization sequence _could_ theoretically be made thread-safe (as long as the initializer does not require isolation), the same way we do with globals, but it would require a significant per-property storage overhead in the actor. It might also need new runtime support.

---

<div class="post-metadata">

**Author:** ![vanvoorden](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/vanvoorden/32/33619_2.png) [@vanvoorden](https://forums.swift.org/u/vanvoorden)\
**Post date:** [May 14, 2025, 7:29pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/4 "2025-05-14T19:29:48Z")

</div>

That makes total sense. I thought maybe we were chipping away at the formal definition of `let` to an extent that `lazy let` might begin to make sense… but that's on me for not reading the proposal close enough. There was no explicit discussion of `lazy let` so I understand that should not be part of the same discussion.

---

<div class="post-metadata">

**Author:** ![Gabardone](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabardone/32/3312_2.png) [@Gabardone](https://forums.swift.org/u/Gabardone)\
**Post date:** [May 16, 2025, 12:37pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/5 "2025-05-16T12:37:45Z")

</div>

Nice, looking forward to using this.

Can we do `lazy let` now? 😉

---

<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 16, 2025, 4:16pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/6 "2025-05-16T16:16:08Z")

</div>

Or property wrappers on `let`s?

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [May 16, 2025, 5:01pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/7 "2025-05-16T17:01:50Z")

</div>

I directly addressed that in the announcement post (and the same applies to `lazy let`). The LSG is perfectly happy to see proposals that are narrowly focused on fixing specific problems.

---

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [May 20, 2025, 10:21am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/8 "2025-05-20T10:21:25Z")

</div>

Hi, pardon my ignorance, I was reading [swift-evolution/proposals/0481-weak-let.md at main · swiftlang/swift-evolution · GitHub](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0481-weak-let.md)

It was stated that the following code would throw the compilation error: `error: reference to captured var 'c' in concurrently-executing code`

However for me it compiles without any error

```swift
final class C: Sendable {
    func foo() {}
}

func makeClosure() -> @Sendable () -> Void {
    let c = C()
    return { [weak c] in
        c?.foo() // expected compilation error but no compilation error

        c = nil // allowed, but surprising and very rare
    }
}

```

Swift Version: `Apple Swift version 6.1`

---

<div class="post-metadata">

**Author:** ![ph1ps](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ph1ps/32/35459_2.png) [@ph1ps](https://forums.swift.org/u/ph1ps)\
**Post date:** [May 20, 2025, 10:29am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/9 "2025-05-20T10:29:08Z")

</div>

This was mentioned in the review:

> [@SE-0481: \`weak let\`](https://forums.swift.org/t/se-0481-weak-let/79603/13):
>
> It’s a bug - see [Let's debug: missing RBI data race diagnostics](https://forums.swift.org/t/lets-debug-missing-rbi-data-race-diagnostics/78910)

---

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [May 20, 2025, 10:45am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/10 "2025-05-20T10:45:15Z")

</div>

Thanks a lot @ph1ps

Just to confirm my understanding:

- Ideally this should be throwing a compilation error in `Swift 6.1` but doesn't and that is a bug.
- Once that bug is fixed, then we would know the importance of `weak let` or is there other scenarios that we can try out (with existing bug)?

---

<div class="post-metadata">

**Author:** ![Nickolas\_Pohilets](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nickolas_pohilets/32/10659_2.png) [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Post date:** [May 20, 2025, 2:10pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/11 "2025-05-20T14:10:43Z")

</div>

Bug affects type checking of `@Sendable` closures, but does not affect checking of `Sendable` classes. So the difference is already visible there.

---

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [May 20, 2025, 2:31pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/12 "2025-05-20T14:31:27Z")

</div>

Thank you so much @Nickolas_Pohilets for the clear explanation!

I missed the most obvious part of the class.

---

<div class="post-metadata">

**Author:** ![jhammer](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jhammer/32/20802_2.png) [@jhammer](https://forums.swift.org/u/jhammer)\
**Post date:** [October 16, 2025, 9:05pm UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/13 "2025-10-16T21:05:49Z")

</div>

I am trying to use a `weak let` stored property in Xcode 26 + Swift 6 and am running into trouble. I’m not sure if this is a bug or my expectations are wrong. Here’s the code:

```swift
actor Foo {}

final class Bar: Sendable {
    weak let foo: Foo?
             `- error: 'weak' must be a mutable variable, because it may change at runtime
    
    init(foo: Foo) {
        self.foo = foo
    }
}

```

Shouldn’t `weak let` work here? My understanding is that it was accepted for Swift 6.2, and Xcode 26 ships with Swift 6.2.

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [October 17, 2025, 2:15am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/14 "2025-10-17T02:15:12Z")

</div>

You can check the proposal headers to see when it shipped, if it has. The `weak let` implementation took a while to congeal, so it didn’t make 6.2, but we currently expect it will ship in Swift 6.3.

---

<div class="post-metadata">

**Author:** ![jhammer](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jhammer/32/20802_2.png) [@jhammer](https://forums.swift.org/u/jhammer)\
**Post date:** [October 17, 2025, 3:19am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/15 "2025-10-17T03:19:45Z")

</div>

Thank you. My mistake. You’re right, it doesn’t show as having shipped yet. Sorry for the noise!

---

<div class="post-metadata">

**Author:** ![Jnosh](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jnosh/32/37375_2.png) [@Jnosh](https://forums.swift.org/u/Jnosh)\
**Post date:** [November 9, 2025, 10:43am UTC](https://forums.swift.org/t/accepted-se-0481-weak-let/79895/16 "2025-11-09T10:43:44Z")

</div>

AFAICT `weak let` [did make it into Swift 6.2](https://github.com/swiftlang/swift/pull/82930), just too late for the initial release.

It is available in the Swift compiler distributed with the Xcode 26.2 beta (which identifies as Swift 6.2.3) so I would expect it to be available in a corresponding public release when that comes around.
