I'm sorry, I have no idea what argument you are trying to make. Start
from the beginning.
On 5/20/2022 1:27 AM, fo...@univ-mlv.fr wrote:
------------------------------------------------------------------------
*From: *"Brian Goetz" <brian.go...@oracle.com>
*To: *"Remi Forax" <fo...@univ-mlv.fr>
*Cc: *"amber-spec-experts" <amber-spec-experts@openjdk.java.net>
*Sent: *Thursday, May 19, 2022 3:05:07 PM
*Subject: *Re: Pattern matching: next steps after JEP 405
When you have a type pattern X in a middle of a pattern *and*
you have conversions, then there is an ambiguity,
does instanceof Box(X x) means
Box(var v) && v instanceof X x
or
Box(var v) && X x = (X) v;
This is not an ambiguity in the language, it is confusion on the
part of the reader :)
In any case, I'm not following your argument here.
If you have both a type pattern and allow conversions, you have
Box(X) is equivalent to Box(var v) && v instanceof Y y && X x = (X) y
How do you find Y ?
And yes, the bar is not only that Y has to be unique for the compiler,
it has also to be obvious for the human reader too.
Rémi