Re: Use of 'self' in static function in subclass

From: Date: Tue, 01 Jun 2004 23:53:42 +0000
Subject: Re: Use of 'self' in static function in subclass
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-10235@lists.php.net to get a copy of this message
Ferdinand Beyer wrote:
On 1 Jun 2004 at 21:13, Timm Friebe wrote:
Yes: self is bound at compiletime. It would need to be changed to evaluation at runtime und would be far more useful then. [...] I wouldn't mind chaning self in the first place, though.
I prefer your solution to evaluate self at runtime instead of adding a new keyword 'this'. The second one would only be confused with $this. Many people (including me) are already familiar with 'self' and expect it to refer to the class from within it is called.
Yeah +1 on self:: binding at runtime. I can't really imagine a case where you would want to refer to 'self' as the class that contains the method *and not* the overridden method in invoked class (if it exists). Binding this at runtime will introduce many new design possibilities with static classes and will also make self:: consistent with $this-> behavior for objects. Hans

« previous php.internals (#10235) next »