Re: [patch] Late static bindings (LSB)
| From: | Etienne Kneuss | Date: | Sun, 16 Sep 2007 14:57:45 +0000 |
| Subject: | Re: [patch] Late static bindings (LSB) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32333@lists.php.net to get a copy of this message | ||
Hi Dmitry,
your patch fails with one test of mine. It may show a difference in the
conception we have of LSB's usage, consider the following snip:
------%<-------------------------------------
<?php
class A {
public static function foo() {
static::who();} public static function who() {
echo __CLASS__."\n";} } class B extends A { public static function test() {
A::foo();} public static function who() {
echo __CLASS__."\n";} } B::test(); ------%<------------------------------------- Since the call A::foo() is completely defined and that no "fall back" occurs, I guess "A" is more expected as a result of this script. Your patch will return B. I discussed this matter quite heavily on #php.pecl and the expectations were also that "A" should get returned here. Now if returning "A" is what we really want for PHP's LSB, I'm not sure whether it's easily doable with your patch. To bring my patch up to date with the latest functionalities like constants access through constant()/defined() and callbacks wouldn't require much work. But if my patch, which uses a slightly different approach (which seems to be simpler according to patch size), have no way to go in anyway, I'd like to know it before I start wasting time on it again. Thanks in advance. -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal