Re: private, protected, readonly, public
| From: | Zeev Suraski | Date: | Mon, 15 May 2006 17:57:26 +0000 |
| Subject: | Re: private, protected, readonly, public | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23388@lists.php.net to get a copy of this message | ||
I agree with Andi on that (surprise surprise :)
What does that give you that class constants don't?
Zeev
At 18:34 12/05/2006, Andi Gutmans wrote:
I can see where it could come in handy but I honestly think it'd be bloat. We have to relax with the OO features because the increased code size has already made it harder to maintain and it has the potential to make PHP far more complicated than what it should be. At 04:35 PM 5/11/2006, Jason Garber wrote:Hello internals, __get() and __set() are great, but 90% of the time, I find myself using them to create public readonly properties. The only problem with this is it is horridly inefficient, consuming at least 1 function call and one switch statement (or equiv) per property read. Would it be possible to create a new object property attribute:-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpreadonlyclass xx {readonly $bar;} $o = new xx(); $o->bar = 10;This way, PHP would allow reading (as if it were public), but only allow writing from within the class. I think it could really boost performance of complicated application logic that wishes to enforce good visibility. Comments? PS. What brought this up was some serious performance issues in a piece of code that I am working with - most of which can be tied back to __get() performance. -- Best regards,FATAL ERRORJason Garber mailto:jason@ionzoft.comIonZoft, Inc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php