Re: private, protected, readonly, public
| From: | Alan Knowles | Date: | Sun, 14 May 2006 01:59:20 +0000 |
| Subject: | Re: private, protected, readonly, public | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23337@lists.php.net to get a copy of this message | ||
Definatly would love to see readonly, It would remove 1000's of lines of useless code from 100's of projects - which might make a few more public PHP projects readable ;)
It replaces pointless giberish with something explicit clean and elegant..
Looks alot tidier than getters, or __get kludges.
Regards
Alan
Hartmut Holzgraefe wrote:
Bastian Grupe wrote:Uhh... how about using private and only using a "regular" getter (the Java-style) and no setter? class xx {i think you're missing the point, the idea is to *not* have to write that extra getter line ... less typing *and* less error prone ... and easier to read, too IMHO You didn't want to return $bar in your example, you wanted to return $this->bar so you already ran into one of the issues here ;)private $bar;public getBar() { return $bar; }}