On 12 Apr 2010, at 16:11, Jonathan Bond-Caron wrote: > On Mon Apr 12 05:16 AM, Stefan Marr wrote: >> >> On 12 Apr 2010, at 10:39, Lukas Kahwe Smith wrote: >>> On 12.04.2010, at 10:34, Derick Rethans wrote: >>>> Hi! >>>> >> But just as a quick response, without aliasing, there would be no way >> to use a conflicting method from a trait. >> On first sight, that is not a really good thing. > > Hi Stefan, is it possible to have renaming and aliasing? > > Some context, say we have: > > trait Something { > function renameIssue() { > $method = 'call'; > $this->$method(); > call_user_func(array($this, $method)); > } > function call () { echo "a"; } function invokeCallDirectly() { $this->call(); } > } > > class Foo { > use Something { > function call() as call2(); > } > } > > With renaming: > > $f = new Foo; > $f->call2(); // a > $f->renameIssue(); // call() method does not exist
I have added invokeCallDirectly() to your example. What should be the semantics of that? Should that call be refitted to invoke call2? Am not sure that this is a good idea, with all this other ways around to call methods dynamically. Ok, aliasing is 'kind of annoying' and unusual but from my perspective not much different then what we do with variables every day. They reference objects, and we introduce new aliases for old objects every now and then. > the syntax could re-use the 'clone' keyword: > > class Foo { > use Something { > function call() clone call2(); > } > } Would be an option, but it reads kind of strange, doesn't it? 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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php