On Mon, Jan 19, 2015 at 9:28 AM, Andrea Faulds <a...@ajf.me> wrote:

> Good morning,
>
> This is a reboot of Davey Shafik’s RFC (with permission). After recent
> discussions about sort functions, I was inspired to bring this back up, as
> I think it would be a useful feature.
>
> The RFC is here: https://wiki.php.net/rfc/combined-comparison-operator
>
> Thanks!
>

I like the idea behind this (exposing internal compare_function), but I
don't want to have an extra operator for a minor use case. Please just
introduce a function instead.

The operator is also less clear ... if I see "$a <=> $b" and do not happen
to be familiar with another language implementing this operator, I won't
have any idea what it does (the closest thing <=> could be is the
equivalence operator from logic, and that's not the case here). On the
other hand something like compare($a, $b) is pretty obvious. If there is
concern about clashing with user-defined functions, lets namespace it.

A function can also be directly used as a callback. Furthermore a function
would fit in well with existing comparison functions like strcmp etc.

Nikita

Nikita

Reply via email to