Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26167 invoked from network); 20 Oct 2012 10:15:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2012 10:15:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=tbprogrammer@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tbprogrammer@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: tbprogrammer@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:51063] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/AD-22055-7C972805 for ; Sat, 20 Oct 2012 06:15:35 -0400 Received: by mail-ob0-f170.google.com with SMTP id ni5so1282126obc.29 for ; Sat, 20 Oct 2012 03:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=GOnYItIZleo8j9QuThDg57ik+XPrpNNlKowDgsTxpkk=; b=k1Z3DZiCU+QUG9BxraS1DmSpxiEfc/3ifhVFhyWNgDZ9Nr3HG/n2N2UJP2AL3qqqpF ATpcLngr70jLUZEuxb+ba3w8jZXFb3s580kPb1nH6JGoQvqnWfskvF6tCToo/LAPodHE xcRWAyEDfSoShjM1Pd1IyqsC+tR5KoucDZZQ1Oo4847FFNs7xlOKFHhOQcas9EFvm4Rm GQ4YxortwxmojdgOAZGAUOS+sXAYobJBSCoIyWM9rBYCYhgrTLJLzIE1+cIzoGfSD4ok vpMhtQ6EknbmBvlyriQ3j8svXsGoknvMy6BuENQJgHgfsyHYDeFiScWa4skdwltb60Mw oR+g== Received: by 10.182.225.5 with SMTP id rg5mr2559612obc.49.1350728132845; Sat, 20 Oct 2012 03:15:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.11.170 with HTTP; Sat, 20 Oct 2012 03:15:12 -0700 (PDT) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485612C2595@MBX214.domain.local> Date: Sat, 20 Oct 2012 03:15:12 -0700 Message-ID: To: Nikita Popov Cc: Amaury Bouchard , Clint Priest , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=f46d04446a498bdf1f04cc7ae6da Subject: Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords From: tbprogrammer@gmail.com (Jazzer Dane) --f46d04446a498bdf1f04cc7ae6da Content-Type: text/plain; charset=ISO-8859-1 Nikita, there appears to be a slight misunderstanding. You're initial email was worded in a way that I presumed you were attacking the final keyword entirely, not just final methods. You are correct in that many PHP frameworks don't have final *functions*. My pushing for the read-only functionality is that it, in my opinion, necessary for cohesiveness with the final keyword. The read-only implementation we are still working on creating is essentially a magic version of > final set() { throw new ReadonlyPropertyException; } > In regards to your third point: Clint sent an email a few days wherein he implied you were the driving factor behind automatic accessors. Sorry for the confusion. Asymmetric accessor visibility is a different subject. It's moderately convenient but I'm worried there's too much magic going on in the background and it's not apparent what the syntax means. We should probably open up another discussion thread for this subject, though. On Sat, Oct 20, 2012 at 2:52 AM, Nikita Popov wrote: > On Sat, Oct 20, 2012 at 11:31 AM, Jazzer Dane > wrote: > > The final keyword is used, especially in sizable OOP applications. > Claiming > > it supposedly isn't used very often anymore - even if it were true - is > not > > an excuse to exclude the "read-only"-esque functionality in this RFC. > Firstly, I didn't make that claim out of thin air, I actually checked > how many final methods are used in ZF and Symfony (which are my usual > reference projects due to their large size) and from that concluded > that "nearly never" is a very accurate description. It could obviously > be that those two projects are somehow special and everyone else uses > large amounts of final methods ;) > > Secondly, low anticipated use is actually a very good reason to > exclude functionality. One shouldn't add features from which you know > right from the start that nearly no-one will use them. > > Thirdly, I don't want to exclude the possibility of enforcing > read-only-ness through the hierarchy. I just don't want to provide a > dedicated syntax for such an edge case. As already mentioned, there > already are sufficiently simple ways to do this: > > // read-only for all classes in the hierarchy, only the current one > can read > final private set(); > // absolutely read-only > final private set() { throw new ReadonlyPropertyException; } > > The latter is even rather clear about the intention ;) > > > My top choice is final get;, which would work quite well and > non-ambiguously > > if we don't implement Nikita's proposed automatic accessor functions or > > implement it in a noticeably different syntax. > Not sure where you got that, but automatic accessor implementations > are not my idea, they were part of the original proposal. I wanted to > remove them, but later we found that they are necessary for various > aspects of the RFC, in particular asymmetric accessor visibility > (public $foo { get; protected set; }). Unless you want to drop that > too automatic implementations have to stay. > > Nikita > --f46d04446a498bdf1f04cc7ae6da--