Re: Accessing child constants from base class

From: Date: Fri, 10 Oct 2003 17:37:29 +0000
Subject: Re: Accessing child constants from base class
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-4784@lists.php.net to get a copy of this message
Hi Marcus- Marcus Börger wrote:
Constants are bound to the class rather then to the objects. Hence they behave pretty much like static properties or default values of declared properties and like the latter they are read only. understood.
The only question here is whether we want to be able to access static and/or const class members through something dynamically like $this at runtime. Everything else is perfectly correct in place. And of course constants are public. So perhaps you might want to be able to apply visibility to constants, too? If so i must dissappoint you with the fact that it is currently impossible to do that and the amount of work to enable this seems so high that it is unlike to happen. So, in order to access class constants from outside the class, the
class itself must be static? Obviously (I thought for backwards compatability only) all classes are static in PHP5, but looking toward the future, will we continue to have all classes always statically accessible? Dan Cox

« previous php.internals (#4784) next »