Re: private, protected, readonly, public
| From: | Stanislav Malyshev | Date: | Wed, 17 May 2006 21:25:13 +0000 |
| Subject: | Re: private, protected, readonly, public | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23556@lists.php.net to get a copy of this message | ||
JM>>1. __get/__set are too cumbersome for simple use cases. (Hence this
JM>>thread)
This thread is in no way "simple use case".
JM>>2. __get/__set is slow. (In the best case: about 10x slower than simple
JM>>property, 3x slower than an accessor method call)
Slow as opposed to calling different function for different properties,
adding additional lookups on each access?
JM>>individual properties, just as you can in Java, C#, Ruby, Delphi,
JM>>Python, Visual Basic, Objective C, Smalltalk, and sometimes C++. (To
JM>>the best of my knowledge.) Read only is a special case of this
JM>>capability.
This would be, however, yet another level of complexity added to the
language...
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115