brian.goetz at oracle.com
Fri Mar 12 13:30:57 UTC 2021
> In the section "Dominance of pattern label",
> It's not clear to me if there is a dominance in between expressions,
> by example, can we have the following cases in that order ?
> case Foo(var a, var b) && a == 3:
> case Foo(var a, var b) && a == 3 && b == 4:
> for me the answer is yes, the dominance is computed on patterns only, not on expressions.
This problem is related to totality; could we determine that
case Foo(int x) && x > 0:
case Foo(int x) && x <= 0:
is total? For this case, sure, but in general, at best we can do a bad
job, and spend more and more effort to get closer, but never quite
getting there. Computing dominance between expressions is the same
problem, with the same sad result.
So, I think the answer is: when you go off into expression world, we
lose the ability to reason about dominance and totality. We know that P
dominates P&g for any g, but that's about as far as we go.
More information about the amber-spec-experts