Re: private, protected, readonly, public
| From: | Tim Van Wassenhove | Date: | Wed, 17 May 2006 11:21:52 +0000 |
| Subject: | Re: private, protected, readonly, public | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23529@lists.php.net to get a copy of this message | ||
On 2006-05-17, Stanislav Malyshev <stas@zend.com> wrote:
> 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.
To me it seems this is going to lead to: (unwanted)
readonly public, readonly protected, readonly private
writeonly public, writeonly protected, writeonly private
readwrite (or regular) public, protected and private
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>