2 ms·
That resolves the problem for other types, but you still have the case of (a == b == c) being parsed and evaluated as ((a == b) == c) if all three are booleans,
by int_19h 2y ago
That resolves the problem for other types, but you still have the case of (a == b == c) being parsed and evaluated as ((a == b) == c) if all three are booleans, which is still not an intuitive interpretation. I think the PL either has to ban such construct outright and require parentheses, or treat it as an n-ary operator like Python does (albeit perhaps with a few more constraints on what you can chain, for the sake of readability).
- throwaway313373 2y agoI've just checked [0], Rust bans such construct for booleans as well. [0] https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=251e09e9dd66a9e653eace3a075a6a4a https://play.rust-lang.org/?version=stable&mode=debug&editio...
- quietbritishjim 2y agoThat is impressive.
- int_19h 2y agoGreat error message, too.