A peek at the roadmap for pattern matching and more
Brian Goetz
brian.goetz at oracle.com
Thu Aug 13 01:51:51 UTC 2020
> In the code:
> public deconstructor B(int a, int b) {
> super(var aa) = this;
> a = aa;
> b = this.b;
> }
> i believe the first line should be
> A(var aa) = super;
P = e
is like
if (e instanceof P) { rest of method }.
What would be on the LHS of the instanceof would be `this`, not `super`. This is like `if (this instanceof super(var aa))`.
> I know that you have consider something like this, but i prefer making the deconstructor a method returning a tuple at Java level, to be closer to the JVM level.
Yes, we did consider this, but I don’t like it, because it’s fake. Having tuple-like syntax that you could only use in one place would feel like “glass 99% empty.” Unless people can use tuples as returns, destructure them, store them in variables, denote their types, pass them to methods, etc, it will just be a tease. No one will thank us, and I don’t think it really carries the message home the way the current framing does.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200812/84de5c11/attachment.htm>
More information about the amber-spec-experts
mailing list