Re: How to build a real Trait thing without exclusion and renaming
| From: | Stefan Marr | Date: | Wed, 27 Feb 2008 14:20:23 +0000 |
| Subject: | Re: How to build a real Trait thing without exclusion and renaming | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35816@lists.php.net to get a copy of this message | ||
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