1) I would very like to see some real example where "static" is necessary?

2) "static" is really bad name. I suggest "caller", Marcus thought about
"class".

3) I COMPLETELY DISAGREE TO ADD RUNTIME DATA INTO
zend_function/zend_op_array.
We can try to store "caller_scope" in execute_data.

Thanks. Dmitry.

> -----Original Message-----
> From: Marcus Boerger [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 01, 2006 4:21 PM
> To: Dmitry Stogov
> Cc: 'PHP-DEV'; 'Mike Lively'; Andi Gutmans
> Subject: Re: [PHP-DEV] [PATCH] Late Static Binding
> 
> 
> Hello Dmitry,
> 
>   i guess there was enough discussion on the name and we do 
> not want to create another solwdown or BC by adding either 
> slow string comparisions or a new keyword. Anyway how can 
> this affect ZTS version? We are working on copies here as far 
> as i know. And the information is touched at runtime anyway 
> since we are doing inheritance at runtime. The way out would 
> be to push the neccessary info on the stack which would be a 
> big argument against supporting late binding because that 
> would be a major slowdown for php everywhere and not only 
> affect static method invocation.
> 
> best regards
> marcus
> 
> Wednesday, March 1, 2006, 1:59:01 PM, you wrote:
> 
> > I didn't look into the patch deep.
> > But I see one critical issue:
> 
> > Patched PHP will modify zend_function->caller_scope at 
> runtime. This 
> > can break ZTS version and probaby opcode caches. Storing runtime 
> > information in zend_function is bad decision.
> 
> > Also the name "static" confusing me.
> > Because "self" behave more 'static' (and proper).
> 
> > Thanks. Dmitry.
> 
> >> -----Original Message-----
> >> From: Marcus Boerger [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, March 01, 2006 3:03 PM
> >> To: Dmitry Stogov
> >> Cc: 'PHP-DEV'; 'Mike Lively'
> >> Subject: Re: [PHP-DEV] [PATCH] Late Static Binding
> >> 
> >> 
> >> Hello Dmitry,
> >> 
> >>   of course, what hinders you?
> >> See original mail from Mike: 
> http://news.php.net/php.internals/21991
> >> 
> >> regards
> >> marcus
> >> 
> >> Wednesday, March 1, 2006, 12:51:51 PM, you wrote:
> >> 
> >> > Can I look into patch?
> >> 
> >> > Dmitry.
> >> 
> >> >> -----Original Message-----
> >> >> From: Marcus Boerger [mailto:[EMAIL PROTECTED]
> >> >> Sent: Wednesday, March 01, 2006 1:01 PM
> >> >> To: PHP-DEV
> >> >> Cc: Andi Gutmans; Mike Lively
> >> >> Subject: Re: [PHP-DEV] [PATCH] Late Static Binding
> >> >> 
> >> >> 
> >> >> Hello internals,
> >> >> 
> >> >>    it looks like either nobody objects or nobody has interest. 
> >> >> Either way i tested the patch and worked helped it a bit and it 
> >> >> looks good, doesn't affect anything else and doesn't 
> show a single 
> >> >> problem in valgrind. So If noone objects i will commit 
> this next 
> >> >> week.
> >> >> 
> >> >> regards
> >> >> marcus
> >> >> 
> >> >> special mail to andi :-)
> >> >> 
> >> >> 
> >> >> Thursday, February 23, 2006, 11:06:02 PM, you wrote:
> >> >> 
> >> >> > I have finished a patch that implements a working version of 
> >> >> > late static binding.
> >> >> 
> >> >> > I used the notes from the Paris PDM as my guidelines for 
> >> >> > implementation.
> >> >> > 
> >> >> (http://www.php.net/~derick/meeting-notes.html#late-static-bin
> >> > ding-using-this-without-or-perhaps-with-a-different-name)
> >> >> > As requested in the notes I reused 'static::'. I also wrote
> >> >> a few tests
> >> >> > not only to test the new functionality but also to make
> >> >> sure 'static' can't be inherited or extended.
> >> >> 
> >> >> > I also added a new function get_caller_class() which
> >> >> returns the name
> >> >> > of the class that static:: would represent.
> >> >> 
> >> >> > (borrowing from PDM notes)
> >> >> > In php5.* the following script outputs "A::static2":
> >> >> 
> >> >> > <?php
> >> >> >         class A {
> >> >> >                 static function staticA() {
> >> >> >                         self::static2();
> >> >> >                 }
> >> >> 
> >> >> >                 static function static2() {
> >> >> >                         echo "A::static2\n";
> >> >> >                 }
> >> >> >         }
> >> >> 
> >> >> >         class B extends A {
> >> >> >                 static function static2() {
> >> >> >                         echo "B::static2\n";
> >> >> >                 }
> >> >> >         }
> >> >> 
> >> >> >         B::staticA();
> >> >> ?>>
> >> >> 
> >> >> > This has somewhat recently been highlighted by different
> >> >> developers to
> >> >> > be somewhat problematic behavior in creating user
> >> friendly APIs. If
> >> >> > you want to see a possible use for it you need look no
> >> further than
> >> >> > the example ZActiveRecord API that was used in their
> >> webcast with
> >> >> > php|arch.
> >> >> > 
> >> >> (http://blog.joshuaeichorn.com/archives/2006/01/09/zactivereco
> >> >> rd-cant-work/)
> >> >> > Currently the code laid out there is impossible short of
> >> >> some ugly use of
> >> >> > debug_backtrace() and file parsing :/. This patch of course
> >> >> would allow that kind of code too exist.
> >> >> 
> >> >> > In a small example based on the one I gave earlier you
> >> could change
> >> >> > the code too the following and have it print "B::static2":
> >> >> 
> >> >> > <?php
> >> >> >         class A {
> >> >> >                 static function staticA() {
> >> >> >                         static::static2();
> >> >> >                 }
> >> >> 
> >> >> >                 static function static2() {
> >> >> >                         echo "A::static2\n";
> >> >> >                 }
> >> >> >         }
> >> >> 
> >> >> >         class B extends A {
> >> >> >                 static function static2() {
> >> >> >                         echo "B::static2\n";
> >> >> >                 }
> >> >> >         }
> >> >> 
> >> >> >         B::staticA();
> >> >> ?>>
> >> >> 
> >> >> > As far as current userland code impact, there is very
> >> >> little as far as
> >> >> > I can tell. No keywords have been added, just another 
> use for an 
> >> >> > existing one. No changes were made to self:: or parent:: so
> >> >> the change
> >> >> > should be pretty transparent. The only thing that I 
> see remotely 
> >> >> > causing any issues would be the new function
> >> >> (get_caller_class().) I
> >> >> > added that just to complete the set so to speak.
> 
> -- 
> 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