Re: RFC: Traits for PHP

From: Date: Tue, 19 Feb 2008 21:51:05 +0000
Subject: Re: RFC: Traits for PHP
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-35619@lists.php.net to get a copy of this message
Stefan Marr wrote:
Hi Stanislav,
traits the included trait is using). Ok this is the scope. Now we would need to adjust all those method bodies, find all method calls on $this->oldMethodName() and change them to $this->newMethodName().
      
You can't - PHP has dynamic method resolution (think $this->$foo()). Also, it has callbacks - what happens if method is registered as callback is renamed?
    
thanks, this is very good reason not to allow renaming, but aliasing. :)
Aliasing doesn't make a lot of sense, as you can always : function newMethod() { return $this->oldMethod(); } just seems like unneeded complexity, without a clear benefit..

« previous php.internals (#35619) next »