Skip to content

Commit d095422

Browse files
committed
SE-0474: Fix typo
1 parent feaf87d commit d095422

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proposals/0474-yielding-accessors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,24 +559,24 @@ Since it would typically be ambiguous whether the `yielding borrow` or `get` sho
559559
A `yielding` accessor lends the value it yields to its caller.
560560
The caller only has access to that value until it resumes the coroutine.
561561
After the coroutine is resumed, it has the opportunity to clean up.
562-
This enables a `yielding borrow` or `mutate` to do interesting work such as constructing aggregates from its base object's fields:
562+
This enables a `yielding borrow` or `mutate` to do interesting work, such as constructing a temporary aggregate from its base object's fields:
563563

564564
```swift
565565
struct Pair<Left : ~Copyable, Right : ~Copyable> : ~Copyable {
566566
var left: Left
567567
var right: Right
568568

569569
var reversed: Pair<Right, Left> {
570-
yielding borrow {
570+
yielding mutate {
571571
let result = Pair<Right, Left>(left: right, right: left)
572-
yield result
572+
yield &result
573573
self = .init(left: result.right, right: result.left)
574574
}
575575
}
576576
}
577577
```
578578

579-
That the borrow ends when the coroutine is resumed means that the lifetime of the lent value is strictly shorter than that of the base value.
579+
That the access ends when the coroutine is resumed means that the lifetime of the lent value is strictly shorter than that of the base value.
580580
In the example above, the lifetime of `reversed` is shorter than that of the `Pair` it is called on.
581581

582582
As discussed in the [accessors vision](https://github.com/rjmccall/swift-evolution/blob/accessors-vision/visions/accessors.md), when a value is merely being projected from the base object and does not need any cleanup after being accessed, this is undesirably limiting:

0 commit comments

Comments
 (0)