Switch labels (null again), some tweaking

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Apr 28 17:09:07 UTC 2021


On 28/04/2021 18:03, 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.

Maurizio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210428/6092dcca/attachment.htm>


More information about the amber-spec-experts mailing list