On Tue, Jun 26, 2018 at 5:50 PM Rudolf Theunissen
<rudolf.theunis...@gmail.com> wrote:
>
> Hi everyone,
>
> This is an RFC that is based on previous discussions here:
> https://externals.io/message/102337
>
> RFC: https://wiki.php.net/rfc/object-comparison
>
> The implementation is tested and appears to be working as expected. :)

I had some off-list contact with Rudi and generally have agreed with
these changes.

However, there may be some value in following Python's lead. In Python
2 they had a `__cmp__` magic method and in Python 3 they removed it
and added all of these:

   __lt__
  __le__
  __eq__
  __ne__
  __gt__
  __ge__

This permits things such as NumPy to overload < to do an element-wise
comparison of the members; something like this:

    np.array([1, 3, 5, 7]) < np.array([2, 1, 6, 6])
    // evaluates to np.array([true, false, true, false)

If we pursue this Pythonic route then we would also need methods for +
- * / % etc. I do not want to derail the conversation too much, but it
does seem opportune to discuss operator overloading more generally.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to