On Mar 1, 2006, at 9:50 PM, Andi Gutmans wrote:
Yeah static is very confusing and I think it's a bad idea.
I'm trying to think what a non-confusing way would be. Some ideas
would be:
a) using "class" e.g. class::method()
b) change behavior of self:: to always be "virtual" and have people
use class_name::method()
Any other ideas? I think we should solve this issue but let's
brainstorm and find the right way, both syntax wise and implementation
wise (without breaking opcode caches).
To me, the ideal solution would be to use __class__ for the early
binding case and self for the late binding case. Are there any
situations now where __class__ and self aren't the same class? To me
__class__ and self are nearly redundant and it is the late binding that
is completely missing.
early:
__class__::method()
__class__::$property
__class__::constant
late:
self::method()
self::$property
self::constant
That seems very consistent to me and easy to explain.
Unfortunately, the problem with making self late binding is that that
there are potential BC breaks. Is that possibility on the table? I
definitely think that self makes more sense as the late binding
keyword, but I think that ship has sailed. Please correct me if I am
wrong.
I didn't like static at first, either, but it grew on me after a
while. Self is already confusing. Without redefining it, any approach
(including doing nothing) is going to involve a degree of confusion.
Regards,
Jeff
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php