Reader mail bag
Brian Goetz
brian.goetz at oracle.com
Sat Apr 14 23:11:21 UTC 2018
This was received on the amber-spec-comments list.
> Begin forwarded message:
>
> From: Daniel Latrémolière <daniel.latremoliere at gmail.com>
> Subject: Record design (and ancillary fields)
> Date: April 13, 2018 at 11:43:40 PM EDT
> To: amber-spec-comments at openjdk.java.net
>
> 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-observers
mailing list