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 buggy

While 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

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

Reply via email to