News for hackers. Stuff that matters.
Re:Java 21: What’s New? by coding123 on Wednesday August 09, 2023 @06:24PM (#37069201)
What is it saying here. Is the (int x, int y) from getters or the constructor? It LOOKs like a constructor, but I can't possibly imagine it's doing anything with the constructor in this call....

Which probably explains the person saying "I hate it".

Re:Java 21: What’s New? by valenterry on Thursday August 10, 2023 @02:53AM (#37072831)
No, I think this only works on Java Records where it's clear what the identifiers are.
Re:Java 21: What’s New? by kaba0 on Thursday August 10, 2023 @04:18AM (#37073431)
You are destructuring the object here, and since it is a record type that is nothing more than its typed, ordered fields listed in the constructor, you just use it as its reverse function here, basically.

Destructuring for other kind of objects are planned with user-defined destructors. But it does have plenty prior art, e.g. in haskell you can deconstruct lists arbitrarily like _:secondElem:rest would bind secondElem logically.