@@ -447,6 +447,10 @@ impl Point_ExtendForward as Vector {
447
447
}
448
448
```
449
449
450
+ > ** TODO:** The second ` impl ` in this example is no longer a valid redeclaration
451
+ > of the first after
452
+ > [ p5366: The name of an ` impl ` in ` class ` scope] ( /proposals/p5366.md ) .
453
+
450
454
More about forward declaring implementations in
451
455
[ its dedicated section] ( #declaring-implementations ) .
452
456
@@ -929,6 +933,9 @@ constraint DrawVectorLegoFish {
929
933
}
930
934
```
931
935
936
+ > ** TODO:** Document that ` Self ` can be omitted, as adopted in
937
+ > [ P5337: Interface extension and ` final impl ` update] ( /proposals/p5337.md ) .
938
+
932
939
In general, Carbon makes no syntactic distinction between the uses of named
933
940
constraints and interfaces, so one may be replaced with the other without
934
941
affecting users. To accomplish this, Carbon allows a named constraint to be used
@@ -1249,6 +1256,10 @@ fn DoHashAndEquals[T:! Hashable](x: T) {
1249
1256
1250
1257
### Interface extension
1251
1258
1259
+ > ** TODO:** Update this section as needed to reflect the fact that an impl of an
1260
+ > interface doesn't impl the interfaces it extends, as adopted in
1261
+ > [ p5168: Forward ` impl ` declaration of an incomplete interface] ( /proposals/p5168.md ) .
1262
+
1252
1263
When implementing an interface, we allow implementing the aliased names as well.
1253
1264
In the case of ` Hashable ` above, this includes all the members of ` Equatable ` ,
1254
1265
obviating the need to implement ` Equatable ` itself:
@@ -1276,6 +1287,9 @@ benefits:
1276
1287
We expect this concept to be common enough to warrant dedicated ` interface `
1277
1288
syntax:
1278
1289
1290
+ > ** TODO:** Update this section to reflect the new syntax adopted in
1291
+ > [ p5337: Interface extension and ` final impl ` update] ( /proposals/p5337.md ) .
1292
+
1279
1293
``` carbon
1280
1294
interface Equatable { fn Equals[self: Self](rhs: Self) -> bool; }
1281
1295
@@ -1326,6 +1340,9 @@ interface SetAlgebra {
1326
1340
}
1327
1341
```
1328
1342
1343
+ > ** TODO:** Document ` extend [final] impl as I ` , as adopted in
1344
+ > [ p5337: Interface extension and ` final impl ` update] ( /proposals/p5337.md ) .
1345
+
1329
1346
** Alternative considered:** The ` extend ` declarations are in the body of the
1330
1347
` interface ` definition instead of the header so we can use
1331
1348
[ associated constants] ( terminology.md#associated-entity ) also defined in the
@@ -1434,6 +1451,9 @@ interface MovieCodec {
1434
1451
1435
1452
#### Diamond dependency issue
1436
1453
1454
+ > ** TODO:** Update this section to reflect the changes in
1455
+ > [ p5168: Forward ` impl ` declaration of an incomplete interface] ( /proposals/p5168.md ) .
1456
+
1437
1457
Consider this set of interfaces, simplified from
1438
1458
[ this example generic graph library doc] ( https://docs.google.com/document/d/15Brjv8NO_96jseSesqer5HbghqSTJICJ_fTaZOH0Mg4/edit?usp=sharing&resourcekey=0-CYSbd6-xF8vYHv9m1rolEQ ) :
1439
1459
@@ -1986,6 +2006,10 @@ keyword `private` before `adapt`, so you might write
1986
2006
1987
2007
## Associated constants
1988
2008
2009
+ > ** TODO:** Update this section to reflect the new rules and guidance on
2010
+ > associated constants in
2011
+ > [ p5168: Forward ` impl ` declaration of an incomplete interface] ( /proposals/p5168.md ) .
2012
+
1989
2013
In addition to associated methods, we allow other kinds of
1990
2014
[ associated entities] ( terminology.md#associated-entity ) . For consistency, we use
1991
2015
the same syntax to describe a compile-time constant in an interface as in a type
@@ -2112,6 +2136,10 @@ Together associated methods and associated class functions are called
2112
2136
_ associated functions_ , much like together methods and class functions are
2113
2137
called [ member functions] ( /docs/design/classes.md#member-functions ) .
2114
2138
2139
+ > ** TODO:** Document rules on where associated function implementations can be
2140
+ > declared, as adopted in
2141
+ > [ p5168: Forward ` impl ` declaration of an incomplete interface] ( /proposals/p5168.md ) .
2142
+
2115
2143
## Associated facets
2116
2144
2117
2145
Associated facets are [ associated constants] ( #associated-constants ) that happen
@@ -4466,6 +4494,9 @@ difference.
4466
4494
4467
4495
#### Prioritization rule
4468
4496
4497
+ > ** TODO:** Document the changes to prioritization adopted in
4498
+ > [ p5337: Interface extension and ` final impl ` update] ( /proposals/p5337.md ) .
4499
+
4469
4500
Since at most one library can contain ` impl ` definitions with a given type
4470
4501
structure, all ` impl ` definitions with a given type structure must be in the
4471
4502
same library. Furthermore by the [ ` impl ` declaration access rules] ( #access ) ,
@@ -4864,6 +4895,10 @@ class Optional(T:! type) {
4864
4895
// ❌ Illegal: impl Optional(i32) as Deref { ... }
4865
4896
```
4866
4897
4898
+ > ** TODO:** Update the following passage to reflect the relaxed overlap rule
4899
+ > adopted in
4900
+ > [ p5337: Interface extension and ` final impl ` update] ( /proposals/p5337.md ) .
4901
+
4867
4902
This prevents any higher-priority impl that overlaps a final impl from being
4868
4903
defined unless it agrees with the ` final ` impl on the overlap. Overlap is
4869
4904
computed between two non-` template ` ` impl ` declaration by
@@ -4996,6 +5031,10 @@ differences between the Carbon design and Rust plans:
4996
5031
4997
5032
## Forward declarations and cyclic references
4998
5033
5034
+ > ** TODO:** Update this section to distinguish between _ defined_ and _ complete_ ,
5035
+ > as adopted in
5036
+ > [ p5087: Qualified lookup into types being defined] ( /proposals/p5087.md ) .
5037
+
4999
5038
Interfaces, named constraints, and their implementations may be forward declared
5000
5039
and then later defined. This is needed to allow cyclic references, for example
5001
5040
when declaring the edges and nodes of a graph. It is also a tool that may be
@@ -5014,6 +5053,10 @@ used.
5014
5053
5015
5054
### Declaring interfaces and named constraints
5016
5055
5056
+ > ** TODO:** Update this section to reflect the additional things you can do with
5057
+ > a defined but incomplete type, as adoped in
5058
+ > [ p5087: Qualified lookup into types being defined] ( /proposals/p5087.md ) .
5059
+
5017
5060
The declaration for an interface or named constraint consists of:
5018
5061
5019
5062
- an optional access-control keyword like ` private ` ,
@@ -5100,6 +5143,9 @@ An incomplete `C` cannot be used in the following contexts:
5100
5143
5101
5144
### Declaring implementations
5102
5145
5146
+ > **TODO:** Update this section to reflect the new rules adopted in
5147
+ > [p5168: Forward `impl` declaration of an incomplete interface](/proposals/p5168.md).
5148
+
5103
5149
The declaration of an interface implementation consists of:
5104
5150
5105
5151
- optional modifier keyword `final`,
@@ -5115,6 +5161,9 @@ The declaration of an interface implementation consists of:
5115
5161
[associated constants](#associated-constants) including
5116
5162
[associated facets](#associated-facets).
5117
5163
5164
+ > **TODO:** Document the redeclaration syntax `impl C.(as I)` adopted in
5165
+ > [p5366: The name of an `impl` in `class` scope](/proposals/p5366.md).
5166
+
5118
5167
**Note:** The type before the `as` is required except in class scope, where it
5119
5168
defaults to `Self` as described in the
5120
5169
[matching and agreeing section](#matching-and-agreeing).
@@ -5154,6 +5203,11 @@ these rules:
5154
5203
5155
5204
### Matching and agreeing
5156
5205
5206
+ > **TODO:** Update this section to reflect the new terminology and rules adopted
5207
+ > in [p3763: Matching redeclarations](/proposals/p3763.md), and the new rules
5208
+ > adopted in
5209
+ > [p5168: Forward `impl` declaration of an incomplete interface](/proposals/p5168.md).
5210
+
5157
5211
Carbon needs to determine if two declarations match in order to say which
5158
5212
definition a forward declaration corresponds to and to verify that nothing is
5159
5213
defined twice. Declarations that match must also agree, meaning they are
@@ -5189,6 +5243,10 @@ expressions match along with
5189
5243
an interface, as in `constraint Equivalent { extend MyInterface; }`, is not
5190
5244
considered to match.
5191
5245
5246
+ > **TODO:** Document the matching rules for the redeclaration syntax
5247
+ > `impl C.(as I)` adopted in
5248
+ > [p5366: The name of an `impl` in `class` scope](/proposals/p5366.md).
5249
+
5192
5250
For implementations to agree:
5193
5251
5194
5252
- The presence of the modifier keyword `final` before `impl` must match
0 commit comments