RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-10-01 Thread Dmitry Stogov
als@lists.php.net > Cc: Stanislav Malyshev; Baptiste Autin; Zoe Slattery; Dmitry > Stogov; Marcus Boerger; Lukas Kahwe Smith; Michael Lively; > Etienne Kneuss; Andi Gutmans > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > Sorry to persist with this, but I

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-28 Thread Robin Fernandes
Sorry to persist with this, but I think it could be really useful to clarify the meaning of static:: outside of method bodies... particularly since parent:: and self:: can already behave very strangely in such scenarios (see http://news.php.net/php.internals/32443 ). For example, I find the follow

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-26 Thread Jingcheng Zhang
Hello, static methods seem exactly like dynamic binded methods now, is there any chance that "abstract static function" being restored from E_STRICT limitation? Currently it is allowed in interfaces, but forbidden in abstract class, I don't know why php implements "static method" in this way, t

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-26 Thread Stanislav Malyshev
So, if I understand you well, Stanislas, you are personally not much into "static::" but more into making that sort of code working : interface iC { public $structure; } abstract class A implements iC { public function display() { echo self::$structure; } }

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-26 Thread Baptiste Autin
Gutmans Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) Hello, if I understand you correctly, you want to radically change the behavior of self:: ? This is not doable as it would break tons of scripts! Regards On 9/27/07, Baptiste Autin <[EMAIL PROTECTED]> wrote: > > >P

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-26 Thread Etienne Kneuss
Hello, if I understand you correctly, you want to radically change the behavior of self:: ? This is not doable as it would break tons of scripts! Regards On 9/27/07, Baptiste Autin <[EMAIL PROTECTED]> wrote: > > >People generally prefer compile-time > >control which is derived from definition r

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-26 Thread Baptiste Autin
>People generally prefer compile-time >control which is derived from definition rather than per-instance >runtime control (implementing interface vs. checking each time if class >has certain methods). It's me again, sorry. So, if I understand you well, Stanislas, you are personally not much int

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-25 Thread Robin Fernandes
On 20/09/2007, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > > I think we better spend time on figuring out the concept and then do the > patch than first do the patch and then discover we don't know how it was > supposed to work :) Here's a question that I think hasn't been discussed and isn't

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-23 Thread Alexey Zakhlestin
On 9/24/07, Michael Lively <[EMAIL PROTECTED]> wrote: > The very phrase late static binding is an oxymoron of sorts :) that's because the term we use is not correct… :) it would be better to say "late binding of static methods" -- Alexey Zakhlestin http://blog.milkfarmsoft.com/

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-23 Thread Michael Lively
27;Marcus Boerger'" <[EMAIL PROTECTED]>; "'Lukas Kahwe Smith'" <[EMAIL PROTECTED]>; "'Michael Lively'" <[EMAIL PROTECTED]>; "'Etienne Kneuss'" <[EMAIL PROTECTED]>; ; "'Andi Gutmans'"

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-23 Thread Stanislav Malyshev
Couldn't I write: isset(static::$structure) ? You could, but that's only runtime. People generally prefer compile-time control which is derived from definition rather than per-instance runtime control (implementing interface vs. checking each time if class has certain methods). So this wil

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-23 Thread Baptiste Autin
>If you mean Client's $structure, the you have to use static::$structure >and it should work. However it's quite a bad design here since you have >no way to ensure class inheriting from Entity would have $structure. Couldn't I write: isset(static::$structure) ? BTW, sorry for my recent vulgar

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-22 Thread Stanislav Malyshev
Like that one, ridiculous: static private function getStruct(&$class) { if(!(is_array(Entity::$struct) && array_key_exists($class, Entity::$struct))) { eval("if(!isset(".$class."::\$structure)) self::array2xml('".$class."');"); eval("Entity::\$struct[\$class] = new SimpleX

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Baptiste Autin
>It's becoming messy now - we now need to start to invent all kinds of >complex propagation rules for it in parallel with the true object >propagation rules. Why not just have an object then? Because if you could only see the incredible number of "get_class($this)" and of "if(__CLASS__!=get_class(

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Stanislav Malyshev
With static:: you are not able to call method of parent with the same name. Ah, I see you point. I'm starting to dislike all this idea of "let's have an object without really having an object"... It's becoming messy now - we now need to start to invent all kinds of complex propagation rules f

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Stanislav Malyshev
I mean, when you want to go upwards, to reach an ancestor class. You can't go upwards, because there's no upwards for classes. You can use the information you already have, via static:: and function that is analogous to it for static and get_parent_class for non-static. But it could also me

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Baptiste Autin
>__CLASS__ returns name of the class, get_parent_class() is the name of >parent class, those are entirely different things, nothing to do with >compiler/run time. Class always has one name and one parent or none. Sorry, I meant: __CLASS__ and get_class($this) They are both different things, and

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Marcus Boerger
it may be a good compromise. > Thanks. Dmitry. >> -Original Message- >> From: Stefan Walk [mailto:[EMAIL PROTECTED] >> Sent: Thursday, September 20, 2007 1:10 PM >> To: Dmitry Stogov; internals@lists.php.net >> Subject: Re: [PHP-DEV] [patch] Late static b

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Dmitry Stogov
#x27;; 'Lukas Kahwe Smith'; > 'Etienne Kneuss'; internals@lists.php.net; 'Andi Gutmans' > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > > class TableSelectExplainBuilder extends TableSelectBuilder > > { > >stat

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Stanislav Malyshev
Now, let's say the "base" class is called "Entity". And let's say I have an inherited class called "Client": Abstract Class Entity { function read() {} function delete() {} ... } Class Client extends Entity { public $id; public $first_name;

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-21 Thread Stanislav Malyshev
class TableSelectExplainBuilder extends TableSelectBuilder { static protected function buildSelectQuery() { return "EXPLAIN ".parent::buildSelectQuery(); } } Why not do static:: instead of parent:: here? -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://w

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Dmitry Stogov
Stogov; 'Marcus Boerger'; 'Lukas Kahwe Smith'; > 'Michael Lively'; 'Etienne Kneuss'; internals@lists.php.net; > 'Andi Gutmans' > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > Stanislav Malyshev wrote: > >

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Michael Lively
Do you have any ideas on how to allow this to be at all useful with inheritance and overriding? If the patch is left to where these examples would all return 'A' and something wasn't put in place to allow overloading a static function AND forward on the original called class What do you mean

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Michael Lively
internals@lists.php.net Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) Is it possible or feasible to distinguish betwenn parent:: and NameOfParentClass::? That would allow to push a call "up" while preserving the called name while not making Class:: mean different things depending on

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Baptiste Autin
ibe, visit: http://www.php.net/unsub.php -Original Message- From: Stanislav Malyshev [mailto:[EMAIL PROTECTED] Sent: jeudi 20 septembre 2007 20:58 To: Zoe Slattery Cc: Dmitry Stogov; 'Marcus Boerger'; 'Lukas Kahwe Smith'; 'Michael Lively'; 'Etienne Kneuss&#x

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Stanislav Malyshev
How about writing the test cases first - and then the patch? I'm fine with that - that's why I asking people for examples of what they want to do with it. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Inte

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Zoe Slattery
Stanislav Malyshev wrote: So we have at least three different views on concept. It seems that patch will be delayed again. :( I think we better spend time on figuring out the concept and then do the patch than first do the patch and then discover we don't know how it was supposed to work :)

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Stanislav Malyshev
Is it possible or feasible to distinguish betwenn parent:: and NameOfParentClass::? That would allow to push a call "up" while I'm not sure I understand - what's the difference? Can you give an example? -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Stanislav Malyshev
So we have at least three different views on concept. It seems that patch will be delayed again. :( I think we better spend time on figuring out the concept and then do the patch than first do the patch and then discover we don't know how it was supposed to work :) -- Stanislav Malyshev, Zend

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Stefan Walk
Is it possible or feasible to distinguish betwenn parent:: and NameOfParentClass::? That would allow to push a call "up" while preserving the called name while not making Class:: mean different things depending on the location of the call, which is a very bad thing IMO (it's an effect that may not

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-20 Thread Dmitry Stogov
2007 1:10 PM > To: Dmitry Stogov; internals@lists.php.net > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > Is it possible or feasible to distinguish betwenn parent:: > and NameOfParentClass::? That would allow to push a call "up" > while preser

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Dmitry Stogov
cus 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... >

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Stanislav Malyshev
Do you have any ideas on how to allow this to be at all useful with inheritance and overriding? If the patch is left to where these examples would all return 'A' and something wasn't put in place to allow overloading a static function AND forward on the original called class What do you mean

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Michael Lively
Or may be both lines must return "A"? (like Etienne's patches do, and like my latest path does) Yes. Do you have any ideas on how to allow this to be at all useful with inheritance and overriding? If the patch is left to where these examples would all return 'A' and something wasn't put in

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Stanislav Malyshev
So to clarify the question... 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.

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Dmitry Stogov
] > Sent: Wednesday, September 19, 2007 3:26 PM > To: Dmitry Stogov > Cc: Marcus Boerger; Lukas Kahwe Smith; Michael Lively; > Etienne Kneuss; internals@lists.php.net; Stanislav Malyshev; > Andi Gutmans > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > oh

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Marcus Boerger
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 >>

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Dmitry Stogov
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' > S

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Alexey Zakhlestin
oh… I guess I see it somehow the third way class A { function foo() { return get_called_class(); } } class B extends A { function bar1() { return self::foo(); // it is called using inheritance-rules } function bar2() { return A::foo(); // it is called di

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Marcus Boerger
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

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-19 Thread Lukas Kahwe Smith
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

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-18 Thread Dmitry Stogov
ndi Gutmans > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > > There is a serious problem with both of these patches as they are now. > > I understand the principal behind > > class A { > static public function test() { echo get_called_class

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-18 Thread Michael Lively
EMAIL PROTECTED]> Cc: ; "Stanislav Malyshev" <[EMAIL PROTECTED]>; "Andi Gutmans" <[EMAIL PROTECTED]> Sent: Tuesday, September 18, 2007 5:59 AM Subject: RE: [PHP-DEV] [patch] Late static bindings (LSB) Hi Etienne, At first thank you for catching the issue. I deside n

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-17 Thread Stanislav Malyshev
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. I think you are ri

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-16 Thread Etienne Kneuss
Michael Lively wrote: 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 he

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-16 Thread Michael Lively
- Original Message - From: "Etienne Kneuss" <[EMAIL PROTECTED]> To: Sent: Sunday, September 16, 2007 10:50 AM Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) However this causes a seg fault in your current patch. I will do a little more checking to

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-16 Thread Michael Lively
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. I've taken a look

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-16 Thread Etienne Kneuss
Hello, I made the update anyway as it looked like it wouldn't take much time. Attached is a updated version of my patch, along with all the tests related to it: http://patches.colder.ch/Zend/late_static_bindings_take7.patch?markup -- Etienne Kneuss http://www.colder.ch Men never do evil so c

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-16 Thread Etienne Kneuss
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: --%<- http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religiou

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-10 Thread Dmitry Stogov
Attached. Thanks. Dmitry. > -Original Message- > From: Etienne Kneuss [mailto:[EMAIL PROTECTED] > Sent: Sunday, September 09, 2007 11:02 PM > To: Dmitry Stogov > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] [patch] Late static bindings (LSB) > > >

Re: [PHP-DEV] [patch] Late static bindings (LSB)

2007-09-09 Thread Etienne Kneuss
Thanks. Dmitry. -Original Message- From: Etienne Kneuss [mailto:[EMAIL PROTECTED] Sent: Friday, August 24, 2007 5:19 PM To: internals@lists.php.net Subject: [PHP-DEV] [patch] Late static bindings (LSB) Hi internals, here is a patch that implements Late static bindinds in a way that m

RE: [PHP-DEV] [patch] Late static bindings (LSB)

2007-08-24 Thread Dmitry Stogov
nks. Dmitry. > -Original Message- > From: Etienne Kneuss [mailto:[EMAIL PROTECTED] > Sent: Friday, August 24, 2007 5:19 PM > To: internals@lists.php.net > Subject: [PHP-DEV] [patch] Late static bindings (LSB) > > > Hi internals, > > here is a patch that impleme

[PHP-DEV] [patch] Late static bindings (LSB)

2007-08-24 Thread Etienne Kneuss
Hi internals, here is a patch that implements Late static bindinds in a way that minimizes the performance hits that were feared. There is no significant slowdown or memory usage increase when running Zend/bench.php, which I assume is a good enough bench for that kind of matter, as it involves