Recursively comparing
forax at univ-mlv.fr
forax at univ-mlv.fr
Tue Feb 27 20:03:06 UTC 2024
> From: "John Bossons" <jbossons at gmail.com>
> To: "Archie Cobbs" <archie.cobbs at gmail.com>
> Cc: "Remi Forax" <forax at univ-mlv.fr>, "Pedro Lamarão"
> <pedro.lamarao at prodist.com.br>, "valhalla-dev" <valhalla-dev at openjdk.org>
> Sent: Tuesday, February 27, 2024 8:36:13 PM
> Subject: Re: Recursively comparing
> Yes, but 'deep' only for (small) value objects that are stored by value.
No, the semantics of a value class instance is independant of the storage, calling == on a value object always behave the same way.
Rémi
> On Tue, Feb 27, 2024 at 12:09 PM Archie Cobbs < [ mailto:archie.cobbs at gmail.com
> | archie.cobbs at gmail.com ] > wrote:
>> On Tue, Feb 27, 2024 at 10:48 AM John Bossons < [ mailto:jbossons at gmail.com |
>> jbossons at gmail.com ] > wrote:
>>> Where the set of field values stored for a value object field contains a field
>>> that is in turn a value object, this recursive definition would imply a
>>> recursive application of == to the set of field values stored for that object,
>>> would it not? Which sounds awfully close to a deep equals test for value object
>>> fields (but not identity fields).
>> That's a good point... so a simple (for Java developers) way to explain the
>> behavior might be: "Deep equals" for value objects and "== equals" for
>> non-value objects.
>> -Archie
>> --
>> Archie L. Cobbs
> --
> Phone: (416) 450-3584 (cell)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20240227/b19aa52c/attachment.htm>
More information about the valhalla-dev
mailing list