
July 8, 2020
11:08 p.m.
On 9/07/20 3:26 am, Brandt Bucher wrote:
match <s>: case <p0> | <p1>: ... case <p2> | <p3> if <g0>: ... case <p4> | <p5>: ... ```
It's safe to use the same decision tree for <p0> through <p3>, but it must be rebuilt for <p4> and <p5>, since <g0> could have done literally *anything*.
I think you're being overly cautious here. To my mind, the guards should be regarded as part of the pattern matching process, and so people shouldn't be writing code that depends on them having side effects. As a nice consequence of adopting that rule, we would be able to say that these are equivalent: case C(a.b): ... case C(x) if x == a.b: ... -- Greg