[Pitch] Proposal for `safe` keyword in closures to simplify `weak` capture pattern

I proposed this back in 2021: `guard` capture specifier for closure capture lists

The core team shared this feedback at the time:

Since then, SE-0345 (if let self instead of if let self = self) and SE-0365 (support for implicit self after self has been unwrapped) both improved the boilerplate situation enough that I don't really think any other sugar is necessary. guard let self else { return } is pretty reasonably lightweight :slight_smile:

12 Likes