> From: "Brian Goetz" <[email protected]>
> To: "Remi Forax" <[email protected]>
> Cc: "amber-spec-experts" <[email protected]>
> 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 

Reply via email to