Wez Furlong wrote:
It is *not* ok to have a static method try and work like a non static method.
In PHP 5, declaring a static method will prevent $this from being initialized.
static means static.  Take this as a hint that what you're trying to
do it wrong :-)

As others have mentioned on the list (and I know I've brought this up before too), it would be *extremely* useful to be able to do this. i.e. use the method statically for generic cases and allow instance objects to use a more specialized behavior.


Why is it "wrong"? It feels intuitive to me, and seems like the kind of feature that would make people choose an interpreted language like PHP as opposed to Java, C#, etc. It'd be really cool, and [without thinking about it too much] I don't see the problem it creates. Certainly there's lots of PHP4 code that did that in a pretty hack, half-working way: if(isset($this)) {...}.

Cheers,
Hans

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to