Re: fatal static call in php 6.0?
| From: | Christian Schneider | Date: | Sun, 28 May 2006 08:24:58 +0000 |
| Subject: | Re: fatal static call in php 6.0? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23747@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote:
That's not about some abstract design principles - it's just a bug in OO implementation, static call should not leave $this from previous context dangling. Of course it's unlpleasant to find your code to rely on buggyWhile that might be true it does not mean that we have to force a 100% separation between static and non-static methods. It would be very PHP-like to allow class URL { function get($url = null) { if (!isset($url)) $url = $this->url; ... } } which could throw an error if $this is used when called statically but still allows the polymorphism of $url->get(); and URL::get("php.net"); which can be very handy in utility classes/functions. While this is not the most crucial of all concepts I still think it is closer to the strength, dynamicity and opiniatedness of PHP than enforcing the keyword static and introducing sort of a strong typing through the backdoor. My $.02, - Chris, follower of the minimalistic-OO school