Skip to content

Commit 5b612ba

Browse files
Amend some bits per review feedback
1 parent d7e4ce3 commit 5b612ba

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/design_notes/variadic_generics_design.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ be seen as just a tuple with N elements. The syntax is thus built around allowin
1717
types into their components, and taking multiple types that will be condensed into a tuple.
1818

1919
For using these types, it is proposed that one destructure the tuple, generally into a single head, and the remaining
20-
tail. This matches the recursive style used in C++.
20+
tail. This matches the recursive style used in C++. There is also some desire to
21+
be able to iterate in both directions (from left or right) rather than fixing
22+
the choice to a single direction.
2123

2224
### Pros
2325

@@ -28,9 +30,11 @@ tail. This matches the recursive style used in C++.
2830
### Cons
2931

3032
- Mentioned by eddyb, a subtuple type could have different padding than its parent.
31-
EG: `&(A, B, C, D) != &A, &(B, C, D)`
33+
EG: `&(A, B, C, D) != &A, &(B, C, D)`
3234

3335
- The `..` syntax is already used in ranges, so some other syntax would be needed
36+
- Note that `...` syntax may be available, as `..=` is now the inclusive
37+
range syntax.
3438

3539
### Syntax
3640

@@ -65,7 +69,7 @@ The trait would contain helpful types and methods for working with variadic tupl
6569

6670
### Cons
6771

68-
- Overlaps with inclusive range syntax, though it shouldn't actually break any backwards compatibility
72+
- None yet.
6973

7074
### Syntax
7175

@@ -131,3 +135,12 @@ all new functionality on top of that idea.
131135
The overlap with range is a common topic of discussion, but all full proposals seem to still use that syntax.
132136
Overall, the basic syntax seems to be agreed on, but usability and 'extra' ergonomic functionality still requires
133137
a lot of work.
138+
139+
## Tuple layout
140+
141+
Another important consideration for these proposals, particularly those resting
142+
on tuples, is the layout of the tuple. We do not currently guarantee any
143+
particular ordering of the fields in a tuple, which can limit our ability to
144+
"subset" the tuple under a reference. See [this
145+
comment](https://github.com/rust-lang/lang-team/pull/76#issuecomment-857206830)
146+
for some discussion.

0 commit comments

Comments
 (0)