2 ms·
I guess I was hoping the same end result would have been reached by different means. I would like to see: new non canonical java.lang.BaseObject, which implem
by specialist 7y ago
I guess I was hoping the same end result would have been reached by different means.
I would like to see:
new non canonical java.lang.BaseObject, which implements nothing.
new interfaces for .toString(), .equals( that ), and .hashCode().
Canonical java.lang.Object implement these new interfaces.
Any code wanting struct, data, record style objects would subclass BaseObject.
The JVM would auto generate missing .toString(), .equals( that ), and .hashCode() as needed. Like when you add a data class to a HashMap.
New syntax for properties, to eliminate need for setter/getter boilerplate.
New syntactic sugar for the static initializer constructor trick, to eliminate constructor boilerplate. Basically make new MyDataObject() {{ a = 1; b = "abc" }} look prettier.
--
Best as I can tell, only the last two would require language changes.