some ideas and concerns:

- I would like to see this in an extension first, i think it's perfectly
doable and people can test it before merging to core

- would be nice if compareTo and equals were used only if left operand and
right operand used the same comparator function.
In other words, $a == $b must not work if $a->__equals and $b->__equals are
two different functions

- otherwise RFC should specify the precedence. if $left operand and $right
operand both have the magic methods, it will call $left->__magic($right),
otherwise, if only the right one has the handler?
  what if the right one has compareTo and the left has only equal? you
probably should add a table that explains which method is called depending
in the availability of the two magic methods in the operands.

- I'd introduce a debug mode that forces php to call both
$left->__equals($right) and $right->__equals($left) so that symmetry is
guaranteed by design. You could do that when "assertions" are active.

gl

Reply via email to