Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-03 Thread Andi Gutmans
I don't agree as I don't think static methods should be virtual. This is what $this-> exists for. Re-design...! Andi At 03:11 PM 6/1/2004 +0200, Bert Slagter wrote: Hi All, I have a class and a subclass, both with a static method: class Foo2 extends Foo { static function Baz() {

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Jevon Wright
>; <[EMAIL PROTECTED]> Sent: Wednesday, June 02, 2004 12:26 PM Subject: Re: [PHP-DEV] Use of 'self' in static function in subclass > On Tue, 2004-06-01 at 19:53, Hans Lellelid wrote: > > Yeah +1 on self:: binding at runtime. I can't really imagine a case > > whe

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Adam Bregenzer
On Tue, 2004-06-01 at 19:53, Hans Lellelid wrote: > 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

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Hans Lellelid
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 ru

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Ferdinand Beyer
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 ins

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Timm Friebe
On Tue, 2004-06-01 at 15:11, Bert Slagter wrote: > Hi All, > > I have a class and a subclass, both with a static method: [...] > Somehow this behaviour seems logical, on the other hand I don't think > it's desired. I think that 'self' should point to the current class, > even if the static metho

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Ferdinand Beyer
On 1 Jun 2004 at 16:19, Bert Slagter wrote: > This is a minimal testcase, in my real life situation there indeed is a > 'abstract static function Baz();' in Class Foo. But indeed, then a > "Fatal error: Cannot call abstract method Foo::Baz() in.." arises.. OK, this is indeed a problem then. -

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Bert Slagter
Ferdinand Beyer wrote: He should define an abstract method Foo::Baz() here. This is a minimal testcase, in my real life situation there indeed is a 'abstract static function Baz();' in Class Foo. But indeed, then a "Fatal error: Cannot call abstract method Foo::Baz() in.." arises.. Bert -- PHP I

Re: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Hans Lellelid
Ferdinand Beyer wrote: On 1 Jun 2004 at 15:21, Stephan Schmidt wrote: Furthermore this renders the template-method pattern quite useless, so IMHO it should be changed. He should define an abstract method Foo::Baz() here. Yes, I agree that design-wise that would be better -- but it will still fa

RE: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Ferdinand Beyer
On 1 Jun 2004 at 15:21, Stephan Schmidt wrote: > Furthermore this renders the template-method pattern quite useless, so > IMHO it should be changed. He should define an abstract method Foo::Baz() here. -- Ferdinand Beyer <[EMAIL PROTECTED]> -- PHP Internals - PHP Runtime Development Mailing

RE: [PHP-DEV] Use of 'self' in static function in subclass

2004-06-01 Thread Stephan Schmidt
Hi, > Somehow this behaviour seems logical, on the other hand I don't think > it's desired. I think that 'self' should point to the current class, > even if the static method resides in a parent class. > > Is this 'self'-behaviour intended? Furthermore this renders the template-method pattern