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
   {
      private $bar;

      public getBar() { return $bar; }
   }


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 ;)


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to