Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23291 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36516 invoked by uid 1010); 11 May 2006 23:35:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36500 invoked from network); 11 May 2006 23:35:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2006 23:35:41 -0000 X-PHP-List-Original-Sender: jason@ionzoft.com X-Host-Fingerprint: 66.216.66.81 mail.ionzoft.com Linux 2.4/2.6 Received: from ([66.216.66.81:33625] helo=mail.ionzoft.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 99/B9-19568-D4AC3644 for ; Thu, 11 May 2006 19:35:41 -0400 Received: from JASONGARBER2 (207-255-4-232-static.aoo.pa.atlanticbb.net [207.255.4.232]) by mail.ionzoft.com (Postfix) with ESMTP id 618908A4005 for ; Thu, 11 May 2006 19:37:02 -0400 (EDT) Date: Thu, 11 May 2006 19:35:36 -0400 X-Mailer: The Bat! (v3.65.03) Professional Reply-To: Jason Garber Organization: IonZoft, Inc. X-Priority: 3 (Normal) Message-ID: <785810036.20060511193536@ionzoft.com> To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: private, protected, readonly, public From: jason@ionzoft.com (Jason Garber) 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: readonly class xx { readonly $bar; } $o = new xx(); $o->bar = 10; >>> FATAL ERROR 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, Jason Garber mailto:jason@ionzoft.com IonZoft, Inc.