Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78306 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93792 invoked from network); 24 Oct 2014 12:12:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2014 12:12:37 -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 198.187.29.245 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.245 imap11-3.ox.privateemail.com Received: from [198.187.29.245] ([198.187.29.245:57764] helo=imap11-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/71-19734-4324A445 for ; Fri, 24 Oct 2014 08:12:37 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 2BC12880154; Fri, 24 Oct 2014 08:12:34 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id D6VExgBMKWrG; Fri, 24 Oct 2014 08:12:34 -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 2737788014B; Fri, 24 Oct 2014 08:12:33 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: <51598611-8662-4E23-9D83-008C42487BD0@ajf.me> Date: Fri, 24 Oct 2014 13:12:30 +0100 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> <51598611-8662-4E23-9D83-008C42487BD0@ajf.me> To: Nikita Popov 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:59, Andrea Faulds wrote: >=20 >>=20 >> 2. If the aim of this RFC is to replace the getFoo() pattern with the = use of "readonly public $foo" properties, a primary difference will be = that a getFoo() method can be declared in an interface, whereas a = "readonly public $foo" property cannot be. Thus code making use of = interfaces will not be able to employ this feature. And I don't think = that allowing properties in interfaces is reasonable at this point, = because the implementations will be limited to simple-storage properties = - only with more comprehensive property accessor support would = implementations be allowed to use more complex backing code. >=20 > Right, interfaces currently can=E2=80=99t declare properties and I=E2=80= =99m not going to change that in this RFC. If I revisit getters and = setters, that would be changed. Still, I think there is usefulness to = this without interfaces=E2=80=A6 it=E2=80=99s just more limited, sadly. >=20 > It would work quite well with getters and setters and interfaces, if = later added. Within interfaces, readonly could be used to avoid = compelling implementing classes to support writing: >=20 > interface Point { > public readonly $x, $y; > } >=20 > But without preventing implementing classes from supporting it. I added a little Future Scope section on this: = https://wiki.php.net/rfc/readonly_properties#puture_scope -- Andrea Faulds http://ajf.me/