Re: Re: The curious case of the comparable objects.
| From: | Stanislav Malyshev | Date: | Sun, 12 Aug 2018 05:47:31 +0000 |
| Subject: | Re: Re: The curious case of the comparable objects. | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103084@lists.php.net to get a copy of this message | ||
Hi!
>
> <https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#user-content-relational-operators>
Ah, I forgot that the spec did define it via array comparison. The spec
also says in
https://github.com/php/php-langspec/blob/master/spec/08-conversions.md#converting-to-array-type:
The order of insertion of the elements into the array is the lexical
order of the instance properties in the class-member-declarations list.
It does not explicitly say array conversion using when comparing, but
reasonable reader would certainly assume so.
So looks like this part of the spec is violated, and I stand corrected -
it's actually defined in this case, and should be fixed to follow the
spec. I still think it makes little sense, but we have the spec, so we
have to follow the spec.
In this case, it's ok to fix it in all active versions - the spec wins I
think. Or, we have to change the spec :)
--
Stas Malyshev
smalyshev@gmail.com