Make records not implicitly final

Samuel Andrés samuel.maurice.andres at gmail.com
Sat Feb 8 16:45:46 UTC 2020


Hi to all,

I hope this is the correct place for comment about Records.

I saw discussions about extension of records here ( 
https://cr.openjdk.java.net/~briangoetz/amber/datum.html ) leading to 
the conclusion that "we should hold this possibility in reserve". I 
understand the main reasons to make records implicitly final and not 
extensible.

Nevertheless, stuctures like records could also be very usefull for 
modeling purposes if they would be extensible. May be the usage could 
lead to a compromise on this point (for example, generating default 
equals() / hashCode() implementations, only for explicitly final 
records, using all the members of the parent class hierarchy). I am not 
a language specialist, but I share my point of view, just in case...

In any case, I think the better way "to hold [the record extension] 
possibility in reserve" is to make them not implicitly final, even if 
the final keyword should be mandatory in a first step. Then, with time, 
it will be possible to make the final keyword optional for records 
either a) to make them implicitly final, or b) to allow record inheritance.

Thanks for reading. I'm sorry for my bad english.

Samuel Andrés




More information about the amber-dev mailing list