On 28/04/2021 18:03, fo...@univ-mlv.fr wrote:
There is no notion of totality for instanceof.
This is not what I understood when reading Brian message:
We made a decision to lump pattern matching in with `instanceof` because it seemed silly to have two almost identical but subtly different constructs for "dynamic type test" and "pattern match" (given that you can do dynamic type tests with patterns.) We knew that this would have some uncomfortable consequences, and what we have tentatively decided to do is outlaw total patterns in instanceof, so that users are not confronted with the subtle difference between `x instanceof Object` and `x instanceof Object o`. This may not be a totally satisfying answer, and we left some room to adjust this, but its where we are.
instanceof featuring a pattern that is total w.r.t. the type of the instanceof expression is outlawed. Which is why I was bringing that up.
Maurizio