16 ms·
Why is the symbol '|' used for or in pattern matching, not '||'? If '|' is used for bitwise or elsewhere in the language then this might lead to confusion.
by logicchains 13y ago
Why is the symbol '|' used for or in pattern matching, not '||'? If '|' is used for bitwise or elsewhere in the language then this might lead to confusion.
- adamnemecek 13y agoIt was probably inherited from ML.
- pcwalton 13y agoML and Scala. Haskell uses a semicolon, but that wouldn't work in Rust's grammar.
- masklinn 13y ago> If '|' is used for bitwise or elsewhere in the language then this might lead to confusion. `||` is the logical or[0], why would it lead to less confusion? (and yes, `|` is the bitwise or[1]) [0] http://static.rust-lang.org/doc/0.10/rust.html#lazy-boolean-operators http://static.rust-lang.org/doc/0.10/rust.html#lazy-boolean-... [1] http://static.rust-lang.org/doc/0.10/rust.html#bitwise-operators http://static.rust-lang.org/doc/0.10/rust.html#bitwise-opera...
- logicchains 13y agoI suppose I just assumed that logical or is closer in meaning to the or in pattern matching than bitwise or is.