"Nicholas Wilson" <iamthewilsona...@hotmail.com> wrote: > On Sunday, 21 June 2015 at 03:23:18 UTC, Dennis Ritchie wrote: >> Recently published documentation Nightly Rust. I saw this: >> https://doc.rust-lang.org/nightly/book/slice-patterns.html >> >> What do you think about this: a terrible thing or a cool > feature? >> >> fn is_symmetric(list: &[u32]) -> bool { >> match list { >> [] | [_] => true, >> [x, inside.., y] if x == y => is_symmetric(inside), >> _ => false >> } >> } > [...] > Also implicit declaration of variables. Urgh.
Patterns are the way that variables are declared in Rust, there's nothing implicit about that. let <pattern> = <expr>; match <expr> { <pattern> = <expr>, <pattern> = <expr>, } fn myfunction(<pattern>, <pattern>) And AFAIK those are the only places where patterns appear and where variables are declared. Tobi