Recursively comparing

Pedro Lamarão pedro.lamarao at prodist.com.br
Tue Feb 27 14:49:00 UTC 2024


Hello all!

In reviewing the latest edition of JEP 401, I came into language that made
me a little confused.

In section "Identity-sensitive operations" we read:

"Fields with primitive types are compared by their bit patterns. Other
field values—both identity and value objects—are recursively compared with
==."

Later, we read:

"Also note that the == operator does not perform a "deep equals" comparison
on identity objects stored in fields (...)"

My understanding of value classes so far has been that value objects are
compared as-if by &&-ing the ==s of its fields. This seems to me the
meaning of identity object fields not being compared by some deep equals
algorithm. However, earlier, the text says that identity objects are
recursively compared with ==. But recursively means to me something similar
to deep: one would "recurse into" the object`s own fields.

I am not a native english speaker. Am I reading this incorrectly? What is
the intention of saying that other field values, including identity object
fields, are recursively compared with ==?

-- 
Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20240227/aa2aa9d1/attachment.htm>


More information about the valhalla-dev mailing list