So to clarify the question...

<?php
class A {
        function foo() {
                return get_called_class();
        }
}
class B extends A {
        function bar() {
                return A::foo();
        }
}
class C extensa A {
        function bar() {
                return B::bar();
        }
}
echo B::foo(); // this must return "B". This is not a question, the question
is in the following two lines...
echo B::bar(); // this must return "B", because B::bar() calls to A::foo()
and A is parent of B, so "late static binding" still the same
echo C::bar(); // this must return "B" too, because C:bar() calls to
B::bar(), but B is not the parent of C, so the call to B::bar() is handled
in the same way as in the previous line.
?>

Is this the expected behavior? (I would prefer it. My previous patches
worked in this way).

Or may be both lines must return "A"? (like Etienne's patches do, and like
my latest path does)

Thanks. Dmitry.

> -----Original Message-----
> From: Marcus Boerger [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 19, 2007 12:43 PM
> To: Lukas Kahwe Smith
> Cc: Dmitry Stogov; 'Michael Lively'; 'Etienne Kneuss'; 
> internals@lists.php.net; 'Stanislav Malyshev'; 'Andi Gutmans'
> Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB)
> 
> 
> Hello Lukas,
> 
>   right, we already have inheritance all over so we should do 
> it here as
>   well. Nice work so far.
> 
> marcus
> 
> Wednesday, September 19, 2007, 9:07:16 AM, you wrote:
> 
> > Dmitry Stogov wrote:
> 
> >> I am not sure which behavior shouldbe in final patch.
> >> It seems like support for inheritance provides more 
> flixebility, but 
> >> makes concept harder to understand.
> 
> > Well inheritance is an advanced OO concept. As such its 
> something that
> > requires a bit of getting into. But making it inconsistent 
> will not help 
> > ease of use.
> 
> > regards,
> > Lukas
> 
> 
> 
> 
> Best regards,
>  Marcus
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Reply via email to