-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Document @ binding syntax for pattern matching #7173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This actually exists now: rusti> match (1,2) { c@(a,b) => println(fmt!("%? %? %?", a, b, c)) }
1 2 (1, 2) |
The tutorial lacks documentation on this. Could this ticket represent the task of adding such documentation? |
@kvanberendonck I have edited your issue to be for documentation. |
There was a discussion to change this from |
This still needs doing. Shouldn't be too hard. |
This probably doesn't need doing anymore, since @ is being removed. |
@kballard hm? Is the pattern-matching |
This is now documented in both the tutorial and the manual http://static.rust-lang.org/doc/master/tutorial.html#pattern-matching It can probably be closed. |
Thanks for the tip @johnsoft! |
Pattern matching binding syntax is not intuitive and requires documentation, as evidenced by the original issue below
Original
Sometimes it is desirable to be able to bind the entire pattern matched to a separate variable. Haskell uses @ for this, and it works nicely.
Consider input (1,2) fed into...
...where c = (1,2), a = 1 and b = 2.
The text was updated successfully, but these errors were encountered: