Introduced by a guard? (Question on Draft Spec for JEP 440 and 441)

David Alayachew davidalayachew at gmail.com
Tue May 23 16:19:50 UTC 2023


Hello Gavin,

> Sorry for my slow reply.

Thank you for the response!

> There are other expressions that can introduce a pattern
> variable, although one could argue whether they would
> occur naturally, for example, B && (n instanceof Integer
> i), where B is some other boolean expression (and other
> variations with nested &&). It’s always a balance trying
> to keep things general, or lock them down. In this case,
> I’ve erred on the general side of the fence.

Makes a lot of sense. I was mildly familiar with the ways that variables
can be introduced in boolean expressions, so I see now how the number of
places where that can occur is way more than I thought. Thank you for the
clarification.

> One other reason for this is that we may in the future
> add some other expression forms that introduce pattern
> variables, and our future selves will be grateful for
> fewer things in the spec to change.

Also makes sense. While it did make things harder to parse, I at least see
the purpose for it now. Plus, this isn't exactly the documentation where
every developer reads it often and is expected to be familiar with it.

> I’m grateful for the attention to detail though - thanks
> for asking!

Anytime.

Thank you for your help!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230523/1672b770/attachment.htm>


More information about the amber-dev mailing list