Re: LSB forward_static_call()

From: Date: Mon, 23 Jun 2008 16:57:09 +0000
Subject: Re: LSB forward_static_call()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-38547@lists.php.net to get a copy of this message
Hi!
It seems natural to think of LSB as a language feature, and so it doesn't feel right to have it partly implemented as a keyword, and then fix the problematic part as function.
There's nothing wrong with functions - call_user_* are functions too, and func_get_args(), etc.
We already see how call_user_func is painful to use (i.e. with methods that use references), that same burden will be put on forward_static_call.
If we have problem with using call_user_* with references, that should be fixed (do we have description of what exactly is missing - like bug report or RFC or something?) But it won't be fixed by changing parent::, so how it's relevant here?
Why would that be no longer possible ? If you want to make a non-forwarding call to the parent class, you can use TheParentClassName::foo();.
Why having parent:: at all then? You could always use the class name, right? But for some reason we do have parent:: - and that reason is that using explicit class name is not a good style in this context, it both obscures the intent and makes unnecessary dependencies in the code. Now imagine on top of that we have name:: and parent:: work differently, so you don't have choice but using name:: for certain things.
It's about 85% slower than a direct call. Sure it's not that slow when measuring absolutely, but we're talking about a feature that will be typically used in frameworks and libraries, so the amount of calls may be quite big.
I do not think extra CPU instruction or two is really the factor here. We are talking about high-level language, not assembly language. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#38547) next »