r/programming • u/davidalayachew • Jul 16 '26
Dan Smith from OpenJDK -- Identifying JDK value class candidates
https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
5
Upvotes
2
u/lood9phee2Ri Jul 16 '26
That's fine (sortof *) but I hope it doesn't further delay finally delivering them as an end-user facility. Is it a good thing if the java stdlib itself uses more value classes where it can? Probably! Is it as important to me as my own classes/records being value classes? Maybe not.
* actually not sure I fully buy the idea from the linked comment chain the anonymous classes always have identity part, haven't fully thought it through but I do vaguely suspect there's situations where you'd prefer value semantics of anon classes. Though of course you can always make a named class, it's a bit of name clutter, feels similar to the "but you can always make a named function" argument python uses for its crippled lambda etc.
I mean, so long as they're open to fixing the "syntactic problem" by allowing a keyword somewhere and don't block the abstract idea of anon value classes one day, I guess that could be added separately too.
2
u/simon_o Jul 21 '26
For those confused: These are only the "non-obvious" candidates – the obvious ones are already directly listed in the JEP itself.
4
u/Worth_Trust_3825 Jul 16 '26
Give me my value Instants, local date times, and all the time package classes as values. I'm tired of operating on longs directly in my hot etls.