Skip to content

Commit

Permalink
Restrict sublist bindings in tuple and tuple struct patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Feb 8, 2016
1 parent 2cd24ce commit 4e9e843
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion text/0000-dotdot-in-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ S(.., subpatN-1, subpatN)
S(subpat1, .., subpatN)
// **NEW**: Tuple struct patterns, any position with a sublist binding.
// The binding has a tuple type.
// By ref bindings are not allowed, because layouts of S(A, B, C, D) and (B, C) are not necessarily
// compatible (e.g. field reordering is possible).
S(subpat1, binding.., subpatN)
// **NEW**: Tuple patterns, any position.
Expand All @@ -87,6 +89,8 @@ S(subpat1, binding.., subpatN)
(subpat1, .., subpatN)
// **NEW**: Tuple patterns, any position with a sublist binding.
// The binding has a tuple type.
// By ref bindings are not allowed, because layouts of (A, B, C, D) and (B, C) are not necessarily
// compatible (e.g. field reordering is possible).
(subpat1, binding.., subpatN)
// Slice patterns, the last position.
Expand All @@ -96,6 +100,7 @@ S(subpat1, binding.., subpatN)
// Slice patterns, any other position.
[subpat1, .., subpatN]
// Slice patterns, any of the above with a subslice binding.
// By ref bindings are allowed, slices and subslices always have compatible layouts.
[subpat1, binding.., subpatN]
```

Expand All @@ -113,7 +118,7 @@ None.
# Alternatives
[alternatives]: #alternatives

None.
Do not permit sublist bindings in tuples and tuple structs at all.

# Unresolved questions
[unresolved]: #unresolved-questions
Expand Down

0 comments on commit 4e9e843

Please sign in to comment.