[External] : Re: Diamond in type patterns (was: Reviewing feedback on patterns in switch)

Brian Goetz brian.goetz at oracle.com
Wed Jan 26 12:23:04 UTC 2022

The questions we did not answer the last time we talk about that subject
- why should we allow raw types here ?

We already have a clear precedent with type patterns in instanceof — which is not a preview feature any more.  So for one, now you’re talking about making a *change* to the existing language semantics.  There are other concerns too.

- given that this is equivalent to an instanceof + cast, why we can not use diamond inference on cast ?

You’re not being clear about what you’re saying, you could be saying either of the following (or others):

 - You’re proposing diamond here, but not there, then your proposal is inconsistent, and therefore stupid.
 - I love your proposal, but I think we should additionally talk about other places to use diamond as well.

I can’t tell which of these you’re saying, or maybe its something else?

- how this inference work ? Is is the same inference than with the diamond constructor ?

Again, I can’t tell whether you’re saying “this is dumb, it can’t work”, or “this is great, but I can’t figure out the details.”

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

More information about the amber-spec-experts mailing list