Re: [PATCH] Late Static Binding

From: Date: Thu, 02 Mar 2006 15:03:22 +0000
Subject: Re: [PATCH] Late Static Binding
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message

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

Thread (59 messages)

« previous php.internals (#22079) next »