Re: Grafts, Traits, horizontal reuse
| From: | Stefan Marr | Date: | Sun, 19 Apr 2009 22:15:35 +0000 |
| Subject: | Re: Grafts, Traits, horizontal reuse | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43740@lists.php.net to get a copy of this message | ||
Hi Larry,
Also, at the risk of scope creep I will ask if any sort of runtime knowledge is being considered? That is, would there be a way to at runtime get a list of all traits that a given class is using, or access them separately?well, the reflection API will be extended to be able to reflect about traits, too. But beside this, there is "no" notion of traits at runtime.
Would that be a possible way around the question of duplicate method names? (Vis, reimplement the conflicting method and then specify which of the trait methods you want to use by calling it, or possibly calling both of them. That would allow for potentially interesting use cases, and force the resolution logic onto the implementer rather than trying to come up with the perfect resolution rules for all case.That is already possible by means of aliasing as described in the RFC [1]. You can provide different aliases for the conflicting methods and then decide how to proceed in the method implemented in the composing class by calling the aliases. Best regards Stefan [1] http://wiki.php.net/rfc/horizontalreuse
--Larry Garfield larry@garfieldtech.com --PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php-- Stefan Marr Programming Technology Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://prog.vub.ac.be/~smarr