>
> > Why would this be confusing? I'd agree if this happened in userland
> (people
> > could wonder why the operators are swapped), but internally we are
> already
> > dealing with this anyway. E.g. when you implement compare_objects you
> have
> > to be aware of this (to understand stuff like the return 1 trick).
>
> Your code suggests (even though RFC never says it) that the left operand
> defines the comparison. However, for the switched operations, the right
> operand would then define the comparison. It is pretty confusing, IMO.
>
> This.  I see in zend_object_do_operation that op1 (LHS) has priority, but
if it's not an object, then op2(RHS) gets the chance to handle it.  So it
works fine in the simple case of (Object and Non-Object), but if you have
two different Objects, both implementing operator overloading in
potentially different ways then the precedence order matters more.  By
having a separate opcode for GREATER, the user can explicitly state who
they want to get precedence.

I realize I'm potentially trying to solve a problem which doesn't exist,
but separating out smaller/greater is a fairly trivial change, so I'd
rather we did it now and avoid potential fail.

-Sara

Reply via email to