Skip to content

Commit 68da31e

Browse files
authored
Initiate review of SE-0465: Standard Library Primitives for Nonescapable Types (#2724)
1 parent 6af0259 commit 68da31e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

proposals/NNNN-nonescapable-stdlib-primitives.md renamed to proposals/0465-nonescapable-stdlib-primitives.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Standard Library Primitives for Nonescapable Types
22

3-
* Proposal: [SE-NNNN](NNNN-nonescapable-stdlib-primitives.md)
3+
* Proposal: [SE-0465](0465-nonescapable-stdlib-primitives.md)
44
* Authors: [Karoy Lorentey](https://github.com/lorentey)
5-
* Review Manager: TBD
6-
* Status: **Awaiting review**
5+
* Review Manager: [Doug Gregor](https://github.com/douggregor)
6+
* Status: **Active review (March 5...18, 2025)**
77
* Roadmap: [Improving Swift performance predictability: ARC improvements and ownership control][Roadmap]
88
* Implementation: https://github.com/swiftlang/swift/pull/73258
9-
* Review: ([Pitch])
9+
* Review: ([Pitch](https://forums.swift.org/t/pitch-nonescapable-standard-library-primitives/77253))
1010

1111
[Roadmap]: https://forums.swift.org/t/a-roadmap-for-improving-swift-performance-predictability-arc-improvements-and-ownership-control/54206
1212
[Pitch]: https://forums.swift.org/t/pitch-nonescapable-standard-library-primitives/77253
@@ -184,7 +184,7 @@ Of course, an optional is of limited use unless we are able to decide whether it
184184
```
185185

186186
- The optional chaining special form `?`:
187-
187+
188188
```swift
189189
func count(of maybeSpan: Span<Int>?) -> Int {
190190
guard let c = maybeSpan?.count else { return 0 }
@@ -200,7 +200,7 @@ Of course, an optional is of limited use unless we are able to decide whether it
200200
return span.count
201201
}
202202
```
203-
203+
204204
These variants all work as expected. To avoid escapability violations, unwrapping the nonescapable optional results in a value with precisely the same lifetime dependencies as the original optional value. This applies to all forms of unwrapping, including pattern matching forms that bind copies of associated values to new variables, like `let span` above -- the resulting `span` value always has the same lifetime as the optional it comes from.
205205

206206
The standard `Optional` type has custom support for comparing optional instances against `nil` using the traditional `==` operator, whether or not the wrapped type conforms to `Equatable`. [SE-0437] generalized this mechanism for noncopyable wrapped types, and it is reasonable to extend this to also cover the nonescapable case:

0 commit comments

Comments
 (0)