News for hackers. Stuff that matters.
Re:Java 21: What’s New? by morepork on Wednesday August 09, 2023 @07:20PM (#37069716)
There's potential confusion whether the int x from the example comes from point.x (field), point.x() (method) or point.getX() (common getter pattern), just one more gotcha
Re:Java 21: What’s New? by the_af on Wednesday August 09, 2023 @08:20PM (#37070208)
By reading the proposal [1], I see it's meant for record types. Records seem to be value classes, i.e. the equivalent to Scala's case classes.

In that case, there's absolutely no ambiguity: there's only one `x` you can be talking about.

By the way, value/case classes are such a boon. Very easy to get used to, and once you have, you want to use them everywhere, I guarantee.

----

[1] https://openjdk.org/jeps/440

Re:Java 21: What’s New? by morepork on Thursday August 10, 2023 @01:38AM (#37072371)
Thanks that makes more sense, I had assumed it was for all types as Point used in the example has the same name as a class in the standard library