Re: Spaceship and NaNs

From: Date: Mon, 15 Jun 2015 21:19:05 +0000
Subject: Re: Spaceship and NaNs
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-86684@lists.php.net to get a copy of this message
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 smalyshev@gmail.com

« previous php.internals (#86684) next »