Skip to content

Commit f337c2f

Browse files
committed
Remove the Alternative: Initializer syntax: result vs. inout syntax
This section was a distraction. Changing the position of `dependsOn` for initializers is not something we need to consider initially.
1 parent 699d547 commit f337c2f

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

proposals/NNNN-lifetime-dependency.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ This is a key requirement for the `Span` type (previously called `BufferView`) b
3838
**Edited** (June 9, 2024):
3939

4040
- New section: Immortal requirements
41-
- New alternative considered: Initializer syntax
4241
- New alternative considered: dependsOn(unchecked) to disable lifetime dependence checking
4342
- Updated future direction: component lifetime syntax
4443
- New example: Escapable properties in a nonescapable type
@@ -851,27 +850,6 @@ Removing a lifetime dependency constraint only affects existing source code in t
851850

852851
## Alternatives considered
853852

854-
### Initializer syntax: result vs. inout syntax
855-
856-
The programming model for initializers is that they return `self` (with an implicit return statement):
857-
858-
`init(arg: ArgType) -> dependsOn(arg) Self`
859-
860-
But some people have criticized this syntax. They prefer to think of an initializer as mutating `self`, which would be
861-
spelled:
862-
863-
`dependsOn(self: arg) init(arg: ArgType)`
864-
865-
We could adopt either or both of these options.
866-
867-
In a future with component lifetimes the syntax would look like either:
868-
869-
`init(arg1: Element, arg2: Element) -> dependsOn(a: arg1, b: arg2) Self {...}`
870-
871-
or
872-
873-
`dependsOn(self.a: arg1, self.b: arg2) init(arg1: Element, arg2: Element) -> Self {...}`
874-
875853
### Different Position
876854

877855
We propose above putting the annotation on the return value, which we believe matches the intuition that the method or property is producing this lifetime dependence alongside the returned value.

0 commit comments

Comments
 (0)