Hi!

>> Just because other comparison ops already return a bool, we can return
>> bool(false) there.

But we can not return bool from operator that is declared as returning
int, and adding extra type would make this operator essentially useless,
as it is meant to be a concise way of comparing two things, and if after
that you need to write a parser to figure out what it returned, it's
much easier to just go back to basic comparison operators.

Since not everything among PHP values is well-ordered, there would be
sets of values for which comparison does not make intuitive sense - i.e.
both < and > are false, etc. In this case, there is no intuitive value
to return, but there should be a well-defined one to return, and we have
a pretty good definition here I think:

https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#relational-operators
-- 
Stas Malyshev
smalys...@gmail.com

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

Reply via email to