Re: private, protected, readonly, public

From: Date: Wed, 17 May 2006 10:30:35 +0000
Subject: Re: private, protected, readonly, public
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
JG>>  private readable $abc;
JG>>  - doesn't make sense.
JG>>  
JG>>  protected readable $abc;
JG>>  - sub-class can read, not write
JG>>  - not visible outside class
JG>>
JG>>  public readable $abc;
JG>>  - sub-class can read, and write
JG>>  - outside class can read, not write

For me such setup seems quite weird - why adding "readable" keyword to 
"public $x" ort "protected $x" makes it read-only? It's not exactly what 
word "readable" means - it means you can read, not you can not write. 
I'd say adding "readable" means everybody could read it, while writing still 
restricted by access modifier, so readable private means only owner can 
write, readable protected means owner and descendants can write and 
readable public is just public. This would make more sense - if we decide 
readable should be a modifier, of course. 

-- 
Stanislav Malyshev, Zend Products Engineer
[email protected]  http://www.zend.com/ +972-3-6139665 ext.115


Thread (92 messages)

« previous php.internals (#23528) next »