On 12.08.2018 at 07:47, Stanislav Malyshev wrote:

>> <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.

Ah, thanks!  However, the given example[1] does not violate the spec,
since the spec says nothing about the order of inherited properties.
Users may rely on a certain order, so the spec should at least state
expicitly that the order of inherited properties is undefined.  It might
be preferable, though, to actually specify the order of inherited
properties (first child, then parent, then grandparent, etc.)  Also the
spec should either define the order of runtime-created properties, or
declare the order to be undefined.  And the spec should not forget about
properties of “use”d traits…

[1] <https://3v4l.org/NLZNm>

Christoph M. Becker

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

Reply via email to