RE: [PHP-DEV] [patch] Late static bindings (LSB)
| From: | Dmitry Stogov | Date: | Thu, 20 Sep 2007 06:26:05 +0000 |
| Subject: | RE: [PHP-DEV] [patch] Late static bindings (LSB) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32393@lists.php.net to get a copy of this message | ||
So we have at least three different views on concept.
It seems that patch will be delayed again. :(
Thanks. Dmitry.
> -----Original Message-----
> From: Stanislav Malyshev [mailto:stas@zend.com]
> Sent: Wednesday, September 19, 2007 8:51 PM
> To: Dmitry Stogov
> Cc: 'Marcus Boerger'; 'Lukas Kahwe Smith'; 'Michael Lively';
> 'Etienne Kneuss'; internals@lists.php.net; 'Andi Gutmans'
> Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB)
>
>
> > 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
>
> I don't understand this. How comes you called A::foo() and you get B?
> Doesn't make sense to me. If you call A::foo, you are
> supposed to get A.
> It looks like your intent is that A::foo() returns different things
> depending on where it is called, which is not good.
>
> > 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.
>
> This should give the same as previous, of course, since in both cases
> B::bar() is called.
>
> > Is this the expected behavior? (I would prefer it. My
> previous patches
> > worked in this way).
>
> I don't think it's good.
>
> > Or may be both lines must return "A"? (like Etienne's
> patches do, and
> > like my latest path does)
>
> Yes.
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>