You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Structural composition is an important use case for nonescapable types. Getting or setting a nonescapable property requires lifetime dependence, just like a function result or an 'inout' parameter. There's no need for explicit annotation in these cases, because only one dependence is possible. A getter returns a value that depends on `self`. A setter replaces the current dependence from `self` with a dependence on `newValue`.
@@ -845,7 +866,7 @@ This was changed after we realized that there was in practice almost always a si
845
866
It should be possible to return a tuple where one part has a lifetime dependency.
846
867
For example:
847
868
```swift
848
-
funcf(a: consume A, b: B) -> (consume(a) C, B)
869
+
funcf(a: A, b: B) -> (dependsOn(a) C, B)
849
870
```
850
871
We expect to address this in the near future in a separate proposal.
851
872
@@ -867,7 +888,7 @@ This could be exposed as an alternate spelling if there were sufficient demand.
The nesting level of a component is the inverse of the nesting level of its lifetime. `a` and `b` are nested components of `Container`, but the lifetime of a `Container` instance is nested within both lifetimes of `a` and `b`.
908
929
930
+
The general form of the `dependsOn` syntax should be thought of as:
Lifetime dependence is not always neatly tied to stored properties. Say that our `Container` now holds multiple elements within its own storage. We can use a top-level `@lifetime` annotation to name an abstract lifetime for all the elements:
0 commit comments