> De: "Maurizio Cimadamore" <maurizio.cimadam...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "Brian Goetz" <brian.go...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Envoyé: Mercredi 28 Avril 2021 19:09:07 > Objet: Re: Switch labels (null again), some tweaking
> On 28/04/2021 18:03, [ mailto:fo...@univ-mlv.fr | 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. Let me re-phrase it, there is no need for a notion of totality on instanceof. (at least at the first level, we need it for sub-patterns) > Maurizio Rémi