> > Java has .equals and .compareTo; these operations are separate. In > Java neither integrates with operators.
Yeah that's right. I was just pointing out that Java's == always checks against the reference and you can't override it (so it's like PHP's ===). Their .equals() method is like PHP's ==. I agree that it's better to separate the two operations, which is why the first message in this thread talked about __equals and __compareTo. However, when I started implementing it, I couldn't see a nice way to separate them internally as everything goes through `compare_function`. On Sun, 24 Jun 2018 at 23:31, Levi Morrison <le...@php.net> wrote: > On Sun, Jun 24, 2018 at 2:31 PM Rudi Theunissen <rtheunis...@php.net> > wrote: > >> > >> Other languages (most? all?) separate equality and ordering for this > reason. > > > > > > Java doesn't really separate them. Their `==` always checks object > reference so is like PHP's ===. > > But they do have the .equals() method on all objects (our ==) and the > collections use that for equality. > > Java has .equals and .compareTo; these operations are separate. In > Java neither integrates with operators. >