"Class names" are already context-dependent.

<?php
class Foo {
        function test() {
                var_dump($this);
        }
}
class Bar extends Foo {
        function test() {
                Foo::test(); /* this is a "dynamic" method call */
        }
}
$x = new Bar();
$x->test();
?>

Thanks. Dmitry.

Alexey Zakhlestin wrote:
> On Tue, Jul 8, 2008 at 3:39 PM, Dmitry Stogov <[EMAIL PROTECTED]> wrote:
>> I took a look into the patch and I don't like it all.
>>
>> At first, I don't see any consistency there.
>> Why parent:: does forwarding but self::, static:: and "class names" don't?
> 
> "class names" don't because, people expect their results to be
> context-independent. It is just a call of "some method" on "some
> class".
> 
> "parent", on the other hand, implies "inheritance". self and static
> should do forwarding too, I think, because they are context-dependent
> by design. forwardind is expected here
> 
>> At second, it's too complicated.
>>
>> I would propose more consistent (from my point of view) and simpler patch.
>>
>> Each call to static method of parent class (it doesn't mater if it was
>> done using parent:: or something else) assumes forwarding of called context.
>>
>> Thanks. Dmitry.
>>
>> Etienne Kneuss wrote:
>>> Hi,
>>>
>>> The patch was made initially by Mike Lively, I adapted it and removed
>>> forward_static_call
>>>
>>> http://patches.colder.ch/Zend/lsb_parent_forwarding_53.patch?markup
>>> http://patches.colder.ch/Zend/lsb_parent_forwarding_HEAD.patch?markup
>>>
>>> They should merge without trouble.
> 
> 
> 

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

Reply via email to