Re: Traits and Properties
| From: | Stefan Marr | Date: | Sun, 19 Dec 2010 19:04:11 +0000 |
| Subject: | Re: Traits and Properties | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51092@lists.php.net to get a copy of this message | ||
Hi Matthew:
On 19 Dec 2010, at 17:22, Matthew Weier O'Phinney wrote:
> Exactly. I wouldn't default to public on conflicts, though -- just with
> the highest declared visibility (e.g., if one trait defines as private
> and the other as protected, protected wins).
I am currently actually implementing the most restricted proposal: all differences in the property
definition will lead to a fatal error.
The reasoning behind this is, that the semantics of state is not predictable and all changes in the
class/traits hierarchies which are incompatible should give the developer an immediate feedback,
i.e., make potentially incompatible code break.
That is not the most 'dynamic' of all possible solutions but seems to fit with the rest of
PHP.
What I have in mind is also not how the methods integrate into the inheritance chain, thus, a
property in the body of the class does not override all property definitions in traits (this is the
case for methods).
I think that will be useful for the very same reason. And well, I hope an educative error message
will steer the crowed in the right direction to use accessors.
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525