Hi Richard,
Richard Quadling schrieb:
Traits as namespaces would solve the issue of conflict in the class
Talker (you would have to explicitly say which trait the method came
from.
Yes, this would solve the conflicts, but is this really handy?
Every explicit reference to a trait/class name has to be adjusted if the
name changes or if there are any incompatible changes in the hierarchies.
Explicit references by names is probably always a solution, but not the
best. The inventors of the trait idea tried to avoid it in favor to
avoid the fragility introduced by it.
I don't know if this can all be resolved at compile time. Surely the
use of call_user_func() and others would impact somehow.
If trait C requires trait D, then this may lead to longer namespaces -
but from my understanding the purpose of namespaces is to resolve
collisions, so it cannot be avoided when there are collisions. (Though
my example doesn't collide - but that's not the point).
I hope this makes some sense.
It would be a possible way, but personally I would not like to go there.
Kind Regards
Stefan
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php