Skip to content

Commit 3656dcc

Browse files
committed
clean up argument vs. parameter, value vs. type, value vs. binding
- I may be wrong on some of these, but this needs to be consistent with Swift documentation.
1 parent f2faa89 commit 3656dcc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

proposals/NNNN-non-escapable.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ func f() {
163163
}
164164
```
165165

166-
#### Constraints on nonescapable arguments
166+
#### Constraints on nonescapable parameters
167167

168-
A value of nonescapable type received as an argument is subject to the same constraints as any other local variable.
169-
In particular, a nonescapable `consuming` argument (and all direct copies thereof) must actually be destroyed during the execution of the function.
170-
This is in contrast to an _escapable_ `consuming` argument which can be disposed of by being returned or stored to an instance property or global variable.
168+
A value of nonescapable type received as an parameter is subject to the same constraints as any other local variable.
169+
In particular, a nonescapable `consuming` parameter (and all direct copies thereof) must actually be destroyed during the execution of the function.
170+
This is in contrast to an _escapable_ `consuming` parameter which can be disposed of by being returned or stored to an instance property or global variable.
171171

172-
#### Values that contain nonescapable values must be nonescapable
172+
#### Types that contain nonescapable values must be nonescapable
173173

174174
Stored struct properties and enum payloads can have nonescapable types if the surrounding type is itself nonescapable.
175175
Equivalently, an escapable struct or enum can only contain escapable values.
@@ -206,7 +206,7 @@ func f() -> NotEscapable { // 🛑 Cannot return a nonescapable type
206206
}
207207
```
208208

209-
A separate proposal describes “lifetime dependency annotations” that can relax this requirement by tying the lifetime of the returned value to the lifetime of some other object, either an argument to the function or `self` in the case of a method or computed property returning a nonescapable type.
209+
A separate proposal describes “lifetime dependency annotations” that can relax this requirement by tying the lifetime of the returned value to the lifetime of another binding. The other binding can be a parameter of a function returning a vaule of a nonescapable type, or con be `self` for a method or computed property returning a value of a nonescapable type.
210210
In particular, struct and enum initializers (which build a new value and return it to the caller) cannot be written without some mechanism similar to that outlined in our companion proposal.
211211

212212
#### Globals and static variables cannot be nonescapable
@@ -223,7 +223,7 @@ Returning a nonescapable value from a closure requires explicit lifetime depende
223223

224224
#### Nonescapable values and concurrency
225225

226-
All of the requirements on use of nonescapable values as function arguments and return values also apply to async functions, including those invoked via `async let`.
226+
All of the requirements on use of nonescapable values as function parameters and return values also apply to async functions, including those invoked via `async let`.
227227

228228
The closures used in `Task.init`, `Task.detached`, or `TaskGroup.addTask` are escaping closures and therefore cannot capture nonescapable values.
229229

0 commit comments

Comments
 (0)