Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78305 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92150 invoked from network); 24 Oct 2014 12:03:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2014 12:03:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:35470] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/11-19734-1204A445 for ; Fri, 24 Oct 2014 08:03:45 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id BF1308C0085; Fri, 24 Oct 2014 08:03:42 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kj3fHmEm96as; Fri, 24 Oct 2014 08:03:42 -0400 (EDT) Received: from oa-edu-171-36.wireless.abdn.ac.uk (oa-edu-171-36.wireless.abdn.ac.uk [137.50.171.36]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 9F06A8C007D; Fri, 24 Oct 2014 08:03:41 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: Date: Fri, 24 Oct 2014 13:03:39 +0100 Cc: Pierre Joye , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <19463287-8FE4-4504-962E-F7CFDEFE5F45@ajf.me> References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> To: Andrey Andreev X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: ajf@ajf.me (Andrea Faulds) > On 24 Oct 2014, at 12:12, Andrey Andreev wrote: >=20 > Pierre, I rarely disagree with you, but this is one such case. >=20 > It is true that we can look at this as a partial solution to a bigger > problem, or as you said - a baby step. However, I see this as the > perfect solution for a very narrow, yet also a very common problem, > and I don't see it blocking a more abstract solution in the future. That=E2=80=99s basically my thoughts on this RFC. I think it=E2=80=99s = still quite useful even if it=E2=80=99s not as useful as it could be = without certain other additions. >=20 > =46rom a userland POV, it is simple, very effective and there's > practically no way to achieve the same goal with less amount of code. >=20 > In short - it's no panacea to all the limitations that we currently > have on property management, but it is still *extremely* useful for > implementing classes that only need to have getters. It=E2=80=99s also faster! > On another note, I share Nikita's concern about using the "readonly" > keyword and I'd love that to be improved, but the best alternative I > could think of is "readable" and IMO it doesn't have a clearer > meaning. Yeah, that=E2=80=99s the problem. It is somewhat unclear, but any other = keyword choice is even more confusing. I discussed this quite a bit in = StackOverflow=E2=80=99s PHP chatroom = (http://chat.stackoverflow.com/rooms/11/php) and couldn=E2=80=99t come = up with anything better. Also, as I note in the RFC, we already use readonly in the docs for some = classes, and for C#-style only-set-once read-only properties, we could = use final or immutable. -- Andrea Faulds http://ajf.me/