Re: [PATCH] Late Static Binding

From: Date: Thu, 02 Mar 2006 19:44:55 +0000
Subject: Re: [PATCH] Late Static Binding
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hello,

On Thu, 2006-03-02 at 14:21 -0500, Jeff Moore wrote:
> On Mar 2, 2006, at 11:33 AM, Mike Lively wrote:
> 
> Hi Mike,
> 
> > In regards to naming: 'static' wasn't my first choice either. In fact I
> > was originally using 'this::' due to me misreading the notes from the
> > PDM.
> 
> Does 'this' work ok?  I like that one.  this:: and $this would both be 
> late binding one for the class the other for the instance.  It makes a 
> lot of sense to me.  I think it explains why self isn't late binding, 
> too.  very nice.
> 
> this::method()
> this::$property
> this::constant
> get_this_class()
> 

My personal preference is this::. As it does help make things clear.
Chances of someone having a class named 'this' is pretty unlikely. The
decision just has to be made of whether or not we want to punish people
using 'this' as a class name. Like I said before 'static::' is the only
label that I know of that will have no BC issues.

On a somewhat related note. What should the behavior be if static:: (or
this::) is used in a non-static function? The current behavior is that
inside of a non-static function self:: == static::. Is this acceptable?
Or should it's usage be discouraged or should be disallowed?

> > (I doubt very strongly that anyone 'relies' on  early
> > binding for static functions...I could be wrong though.)
> 
> But they do for static properties.  Changing the meaning of 
> self::$property would probably break some stuff.
> 

Maybe, it's hard to know how people are using it for sure. Which is why
I think it's a bad idea to change the meaning of self::.

ds-


Thread (59 messages)

« previous php.internals (#22092) next »