I am having trouble understanding the purpose of Unconditional Patterns
David Alayachew
davidalayachew at gmail.com
Mon Jan 2 13:51:20 UTC 2023
Hello Merlin,
> I can confirm this for Eclipse Adoptium
> 19.0.1+10 and Eclipse Adoptium 17.0.5+8
> on MacOS with your code.
Thank you for the confirmation. I have been running into configuration
errors all day, so I am glad this isn't some mistake on my part.
> Nerveless your last Question regarding
> why input instanceof Triple t raises an
> error but input instanceof Triple is
> simpler. The latter is not a Pattern,
> it’s a Boolean expression and is a
> permanent feature since the
> introduction of instance of.
Thank you for clarifying. Ok, that is good to know. So, in short, the
reason why this distinction exists between instanceof the original and
instanceof pattern match is because the old functionality has not changed
at all. Which does lead into the next question nicely.
> Is it possible that the Compiler
> interprets instance of Patterns with
> Record Classes as Record Patterns?
This was my first instinct as well, but since this error message is so
directed with a very specific, new piece of vocabulary, it sounds unlikely.
Plus, the blog I linked written by Nicolai Parlog used an example involving
String and Object, neither of which is a record.
Still, this did clarify a lot for me and helped me understand things better.
Thank you for your help and insight!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230102/f2422bed/attachment.htm>
More information about the amber-dev
mailing list