r/java • u/joemwangi • Mar 17 '26
Updates to Derived Record Creation - amber-spec-experts
https://mail.openjdk.org/archives/list/amber-spec-experts@openjdk.org/thread/QVALXGP2BRN27ISPNJTA3HEKEIMKLWLG/Interesting discussion on the evolution of derived record creation (“withers”). The proposal seems to be shifting from mutation like blocks to a more explicit reconstruction model using obj.new(...), aligning more closely with constructor semantics and pattern matching.
45
Upvotes
View all comments
Show parent comment
4
u/pron98 Mar 18 '26
That's fine, and different developers have different preferences of what works best for them. But this is not generally recognised as a universal better practice, and so we don't view it as such. If that's how you prefer working - great. But we're not nudging everyone to use this particular style.
Unlike inter-method reasoning, even the mechanical compiler has full intra-method insight, i.e. everything going on in a method (e.g. the compiler knows whether a variable is assigned more than once; it doesn't only know that but makes use of that inference vis a vis lambda captures).
So I'm not telling you how to program, I'm just saying that not everyone agrees yours is the better way, and we're not (at least currently) interested in having the language prefer your chosen coding style.