Skip to content

Commit e909a9d

Browse files
committed
Update while let with pattern alternatives.
1 parent ffb3570 commit e909a9d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

active/0000-while-let.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ be.
7373
As with `if let`, this could plausibly be done with a macro, but it would be ugly and produce bad
7474
error messages.
7575

76+
`while let` could be extended to support alternative patterns, just as match arms do. This is not
77+
part of the main proposal for the same reason it was left out of `if let`, which is that a) it looks
78+
weird, and b) it's a bit of an odd coupling with the `let` keyword as alternatives like this aren't
79+
going to be introducing variable bindings. However, it would make `while let` more general and able
80+
to replace more instances of `loop { match { ... } }` than is possible with the main design.
81+
7682
# Unresolved questions
7783

7884
None.

0 commit comments

Comments
 (0)