ID:               30934
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jbs at fromru dot com
 Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: *
 PHP Version:      5.*
 Assigned To:      andi
 New Comment:

>> First 'self' is bound at compile time (that's the way
>> OOP works).
>Thats how Java works. Not All OO Languages do. PHP is a 
>dynamic language

It is not really a matter of performance here. It is just a different
model of acting. And it is the way static works correct. If you read
the example outline, you'll find out that it cannot work in a different
way. The only thing one can do here is to eventually add what you want
somehow.


Previous Comments:
------------------------------------------------------------------------

[2005-04-25 10:39:54] php-bugs at foomatic dot net

> First 'self' is bound at compile time (that's the way OOP works).

Thats how Java works. Not All OO Languages do. PHP is a dynamic
language, and shouldn't really suffer a significant performance hit by
binding at run time (Especially considering it's still compiled, thus
bound, for every single request anyway). 

> what you want is something like 'called_class'

As long as it's bound at runtime, I don't particuarly care what it's
called. :-).

------------------------------------------------------------------------

[2005-04-25 07:49:05] [EMAIL PROTECTED]

First 'self' is bound at compile time (that's the way OOP works).

Second what you want is something like 'called_class'. Assume you have
a static private member in your base class and a static function and
your derived class does not overload that function. If now your static
function is called with the derived class and 'self' would be changed
to the requested behavior php won't be able to access the property.
Thus you want an additional info maybe called 'used_class'.

Third to allow what you need a major change is needed that would slow
down php - every part of php code execution. And that will take a
while.

------------------------------------------------------------------------

[2005-04-25 06:24:04] php-bugs at foomatic dot net

Does anyone whats happening with this bug? Is it going to be fixed or
are the PHP devs just ignoring it?

Unless this is fixed (or a suitable workaround is added) I cannot put
common code that refers to static variables or methods in a base class,
resulting in significant code duplication. This is a huge issue, and is
a perfect example  of why PHP is regarded with contempt in many
circles.

My choices at the moment are to either continue hacking around it and
clean up once it's been fixed, or rewrite a significant amount of
legacy code in a real language. Given the rating of this bug, it looks
like I'm not the only one.

------------------------------------------------------------------------

[2005-04-12 13:28:53] [EMAIL PROTECTED]

I think this really needs to be addressed. For example the php manual
features a sample singleton implementation:
http://www.php.net/manual/en/language.oop5.patterns.php

Now how would one go about making it possible to extend the "Example"
class without having to cut and paste the singleton() method to this
extended class (one would probably also need to the instance property
to hold an array of instances keyed be the class name)? Not exactly in
the spirit of OOP imho.

It seems to me the best solution to retain this "speed optimization" of
resolving these things at compile time is to copy the implementations of
static items over to classes that extend that class before this
evaluation is done. Just a thought from an outside perspective, dunno
if this is feasible however in the ZE2 implementation.

------------------------------------------------------------------------

[2005-04-11 23:14:42] aknaub at 3st dot de

Sorry, but this quote is nonsense. Every real OOP 
language (Ruby, ObjC etc.) resolves static methods at 
runtime.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/30934

-- 
Edit this bug report at http://bugs.php.net/?id=30934&edit=1

Reply via email to