Record design (and ancillary fields)

Daniel Latrémolière daniel.latremoliere at gmail.com
Sat Apr 14 03:43:40 UTC 2018


Isn't it possible to do for a record, like database design:

- fields are, by default, read-write and not concerned by identity of 
the row/instance.

- one special field (primary key) has all constraints of the identity of 
the row/instance.


For a record, that would signify that one field has to be marked 
__Identity. It will be the only field used in equals/hashCode methods of 
the record.

For satisfying constraints of identity (immutability), this field would 
be final and necessarily of a primitive type or value type (composite 
primary key). Given a value type can be scalarized in the class, 
restricting identity to only one field would not have real cost in instance.


Just my point of view,

Daniel.


PS: Given primitive/value type disallow cyclical references, this will 
prohibit StackOverflowException in equals/hashCode methods.




More information about the amber-spec-comments mailing list