Switch labels (null again), some tweaking

forax at univ-mlv.fr forax at univ-mlv.fr
Wed Apr 28 17:12:37 UTC 2021


> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Brian Goetz" <brian.goetz at oracle.com>, "amber-spec-experts"
> <amber-spec-experts at 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:forax at univ-mlv.fr | forax at 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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210428/b636ce4f/attachment.htm>


More information about the amber-spec-experts mailing list