On Sun, Oct 17, 2010 at 2:06 AM, Reinier Zwitserloot <[email protected]> wrote:
\> But now we're in deep trouble. If [0, 0, 1] is equal to [0, 0], and
> [0, 0] is in turn equal to [0, 0, 2], we are forced by the
> transitivity rule to conclude that [0, 0, 1] is equal to [0, 0, 2].
> But that's preposterous! Nobody  would expect these 2 different points
> in 3D space to nevertheless be .equals() to each other. And yet,
> that's the ONLY way to get equality right if Point is written with
> that instanceof check.


I guess this example is why I like the type class approach.  I can
easily imagine there may be a desire to have an EqualsIn2d<Point>
checker that does exactly as you said.  Wouldn't even have to be
"preposterous."

I cede that there is a lot that would have to be rewritten to get this
equals method in many of the standard collections.  But, I can't
imagine it would be any worse than having stuff like the
IdentityHashMap.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to