@@ -389,21 +389,19 @@ We propose above using the existing `borrow`/`mutate`/`consume`/`copy` keywords,
389
389
390
390
We also considered ` borrowing ` /` mutating ` /` consuming ` /` copying ` but felt that the semantic differences merited using a different form of these words.
391
391
392
- Other alternatives considered include:
393
-
394
- ```
395
- func f(arg1: Array<Int>) -> @dependsOn(arg1) BufferReference<Int>
396
- ```
397
-
398
- The above syntax states the dependency, but could require elaboration to clarify the type of dependency.
399
- As illustrated by the inference rules above, there is often only one reasonable lifetime dependency type for a particular situation.
400
- But ` copy ` and “Downgraded dependencies” described below complicate this somewhat.
401
-
392
+ We could have a single ` scoped ` annotation that covers the ` borrow ` and ` mutate ` semantics described above,
393
+ since the semantics are implied by the argument.
394
+ Similarly we could collapse ` copy ` and ` consume ` to use just ` copy ` (since they are formally identical).
395
+ That would give us two notations rather than the four in our current proposal:
402
396
```
403
- func f(arg1: Array<Int>) -> @scoped(arg1) BufferReference<Int>
397
+ // `borrow` and `mutate` semantics could share a single annotation:
398
+ func f(arg1: borrow Array<Int>) -> scoped(arg1) BufferReference<Int> // Same as `borrow(arg1)`
399
+ func f(arg1: inout Array<Int>) -> scoped(arg1) BufferReference<Int> // Same as `mutate(arg1)`
404
400
```
405
401
406
- Lifetime dependencies are sometimes referred to as “scoped access.” We find this terminology less natural in practice.
402
+ This single ` scoped ` notation would prevent us from eventually supporting the
403
+ “Downgraded dependencies” described below.
404
+ The ` scoped ` notation could also be spelled ` @scoped ` or ` @dependsOn ` .
407
405
408
406
#### Implicit argument convention or method mutation modifier
409
407
0 commit comments