r/java • u/bobbie434343 • Aug 25 '26
Value Classes Still Need Compiler Sympathy
https://johan-sjolen.github.io/post/compiler-sympathy/compiler-sympathy/
88
Upvotes
r/java • u/bobbie434343 • Aug 25 '26
View all comments
Show parent comment
1
u/Jon_Finn Sep 15 '26 edited Sep 15 '26
Where we disagree basically is this: I say that value classes are hardly different from regular classes - due to the impressive generalisations made by the Valhalla team. The main differences are a mild restriction on fields (the majority of fields I write are final anyway) and a change in == (which is rarely used anyway). So... they're nearly regular classes; If the keyword was just (say) 'valhalla' not 'value', it would be easier to see that adding this says nothing about what you should use them to represent, so just like regular classes.