Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23316 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53395 invoked by uid 1010); 12 May 2006 19:16:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53380 invoked from network); 12 May 2006 19:16:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2006 19:16:32 -0000 X-PHP-List-Original-Sender: itrebal@gmail.com X-Host-Fingerprint: 66.249.82.203 wx-out-0102.google.com Linux 2.4/2.6 Received: from ([66.249.82.203:26831] helo=wx-out-0102.google.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id DF/E9-19568-F0FD4644 for ; Fri, 12 May 2006 15:16:31 -0400 Received: by wx-out-0102.google.com with SMTP id h28so399760wxd for ; Fri, 12 May 2006 12:16:27 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Z4L1WGjY4sWnjgIP0xwjVVw6F86SJ2BBK0Pi87mfEC2G4GUzmHlF1RbhhebiDfOvVVgApzpCaGvxgnh7AgszjJNxc8eSjO5xZvGav0EECJ7PG//A1tpzenHoDR9tuBJf97+wNosA6RApweDyfRaiVMaWZnCAoPVlB5R54HpM5Lo= Received: by 10.70.132.20 with SMTP id f20mr3702761wxd; Fri, 12 May 2006 12:16:27 -0700 (PDT) Received: by 10.70.38.7 with HTTP; Fri, 12 May 2006 12:16:27 -0700 (PDT) Message-ID: <2e24b1e00605121216x6c873e0eo5efaf960f5e00a74@mail.gmail.com> Date: Fri, 12 May 2006 15:16:27 -0400 To: "Hartmut Holzgraefe" Cc: "Bastian Grupe" , "Jason Garber" , internals@lists.php.net In-Reply-To: <4464CF54.7070802@php.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_28150_32885088.1147461387816" References: <785810036.20060511193536@ionzoft.com> <4464AC64.5050706@gmail.com> <4464C6C9.40307@php.net> <4464C8AE.1050806@gmail.com> <4464CF54.7070802@php.net> Subject: Re: [PHP-DEV] private, protected, readonly, public From: itrebal@gmail.com ------=_Part_28150_32885088.1147461387816 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline It seems to me this would be a great option to add. How difficult would it be? Would it take significant editing of the source code? I don't see the issue in adding it - seems like it would have plenty of places to be used. Though, if it is added, the name 'readonly' seems a little misleading. It gives off the idea of being able to set it, and not edit again, and not onl= y being able to edit it inside the class. On 5/12/06, Hartmut Holzgraefe wrote: > > Bastian Grupe wrote: > > Blame my recent use of Java here ;-) > > > > Well, I think the whole point of ppp is to having to use setters and > > getters consistently. > > i'm going to blame your use of Java for this one, ppp is way older > than the setter/getter fashion and as far as i remember the main > reason to introduce the setter/getter pattern into java was to > have a standard way for Java IDEs to provide access to Java Bean > properties in property dialogs in their GUI design tools > > > I personally wouldn't like to be able to access some members which are > > private, and not others. It just *feels* wrong. > > Think of it as a more fine grained permission system, like unix > file attributes. Reading and writing a property value are two > different operations and it makes sense to distinguish access > rights not only by ownership but also by type of operation. > > > And I don't know whether or not less typing is really a good argument i= n > > this situation (think unreadable code in shortcut-ish programming > > languages). > > Less typing is not an argument by itself, else we'd all do APL > > But less typing is less error prone (and no, plese *don't* mention > auto-completion here ;), it can be less readable, too, and in this > special case it spreads information that should be in one place. > Maintainability can become an issue, too. > > Take a look at typical PHP class implementations: they have > all properties on top followed by the member functions. So to find > out whether a private property is really provite or whether it has > a getter or even a setter, too, i would have to browse the full > class code. > > class example { > private $foo; > private $bar; > [... more properties ...] > > function __construct() {...} > function __destruct() {...} > > function getFoo() {...} > > [... more code ...] > } > > So $foo is readonly here and $bar is really private. Or wait, > maybe we have just overlooked getBar()? > > With > > readonly $foo; > > on the other hand you have all the information in one place. > > If you want to go the getter/setter path all the way then we > wouldn't need all the ppp stuff anymore alltogether, we would > just make everything private and have the getter and setter > decide (using instanceof on $this etc.) the access rights. > > > -- > Hartmut Holzgraefe, Senior Support Engineer . > MySQL AB, www.mysql.com > > Are you certified? http://www.mysql.com/training/certification > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 ------------------------------------ Graham Christensen www.itrebal.com www.iamgraham.net ------=_Part_28150_32885088.1147461387816--