Re: [RFC] Spaceship operator RFC
| From: | Stanislav Malyshev | Date: | Sun, 19 Apr 2015 22:07:32 +0000 |
| Subject: | Re: [RFC] Spaceship operator RFC | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85872@lists.php.net to get a copy of this message | ||
Hi!
> A discrepancy between the actual behavior of the spaceship operator and
> an example given in its RFC has been reported recently (bug #69466[1]).
I'm not sure what the discrepancy is, could you explain?
> To me it appears that there is a contradiction in the RFC (see my
> comment on the respective report), which would have to be resolved one
> way or another.
I don't see the contradiction. The objects in your example are not
comparable, since $a < $b and $b < $a are both not true, 1 is returned.
Returning 0 would be wrong of course since these objects are not equal.
In fact, there's no "right" value in this case as objects are not
comparable - so the result is undefined. In this case, undefined is 1.
--
Stas Malyshev
smalyshev@gmail.com