Re: tired of referencing static variables/constants with 'self ::'
| From: | D. Dante Lorenso | Date: | Tue, 09 May 2006 21:55:19 +0000 |
| Subject: | Re: tired of referencing static variables/constants with 'self ::' | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235830@lists.php.net to get a copy of this message | ||
D. Dante Lorenso wrote:
As an OOP programmer, I would expect the scope search to be as follows: 1. LOCAL: current method 2. THIS: current instance ($this) 3. SELF: current class & parent classes, in order of inheritance 4. GLOBAL: globalsActually, 2 and 3 are really the same but only vary whether the class member was referenced via an object or statically, and this SHOULD already be known to PHP based on the class declaration. So, forcing a programmer to constantly embed the 'this is a static reference (self::)' or 'this is not a static reference ($this->)' prepended to each variable is definitely boiler-plate, redundant, and not necessary. Dante