Re: [VOTE] ::class feature to resolve namespaced class names to scalars

From: Date: Thu, 13 Sep 2012 21:19:34 +0000
Subject: Re: [VOTE] ::class feature to resolve namespaced class names to scalars
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-62988@lists.php.net to get a copy of this message
Stas, On Thu, Sep 13, 2012 at 4:58 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote: > Hi! > > >>> I would expect $variable::class to work (like late static bindings). > > What this would mean? ClassName::class has a clear meaning - ClassName > is a name of the class (possibly aliased) and class is the property of > this class, namely its full name. However I do not see how > $variable::class can do anything meaningful. Since namespace resolution > is static compile-time, $variable can not be anything but the full name > of the class, so what $variable::class supposed to do? Just be equal to > $variable? What's the point of such operation, what may be achieved by it? > Right now, you can access static properties and methods from a string/object by doing $var::$foo... I would assume that this works the same way. That way, you can take in a string class name, or an object, and get the class in one shot $obj::class instead of get_class($obj)... Just for consistency... Anthony

« previous php.internals (#62988) next »