#30934 [Com]: Special keyword 'self' inherited in child classes
| From: | aknaub at 3st dot de | Date: | Mon, 11 Apr 2005 21:14:43 +0000 |
| Subject: | #30934 [Com]: Special keyword 'self' inherited in child classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76665@lists.php.net to get a copy of this message | ||
ID: 30934
Comment by: aknaub at 3st dot de
Reported By: jbs at fromru dot com
Status: Assigned
Bug Type: Class/Object related
Operating System: *
PHP Version: 5.0.3
Assigned To: andi
New Comment:
Sorry, but this quote is nonsense. Every real OOP
language (Ruby, ObjC etc.) resolves static methods at
runtime.
Previous Comments:
------------------------------------------------------------------------
[2005-04-11 13:50:15] jbs at fromru dot com
I've noticed some similar reports. For example, the one at
http://bugs.php.net/bug.php?id=30235.
Here is a quote:
>
> Sorry, you have a complete wrong idea og OO programming.
>
> Static methods are bound/resolved at compile time.
> That is the compiler can replace self with the current
> class.
>
So, it appears as it is a limitation of the compiler and the entire
object model.
I think such behavior makes inheritance of static methods useless
because even if a static method is inherited, it still functions as in
the class where it was declared. Moreover, inherited static methods are
using the static properties which were declared in the parent class but
not the inherited one.
So, in my opinion "self" keyword should be replaced with the name of
the inherited class during compiling. Or at least a new magic keyword
should be added and named like "this", for example.
------------------------------------------------------------------------
[2005-03-30 23:47:28] sniper@php.net
Andi, is this a bug or not?
------------------------------------------------------------------------
[2005-03-29 09:10:20] aknaub at 3st dot de
I reproduced the bug with snapshot php5-200503282030,
compiled as cli on Mac OS X 10.3.8.
------------------------------------------------------------------------
[2005-03-27 01:18:39] mongole at tuivelsminne dot at
I reproduced the bug with snapshot php5-200503262330, compiled as
mod_php in apache-1.3.33 on FC 3.
------------------------------------------------------------------------
[2005-03-25 01:21:31] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
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