Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78448 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97515 invoked from network); 30 Oct 2014 01:35:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2014 01:35:48 -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:56604] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/F2-09383-2F591545 for ; Wed, 29 Oct 2014 20:35:47 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 6A2358C0081; Wed, 29 Oct 2014 21:35:44 -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 YCiFzslSAvMc; Wed, 29 Oct 2014 21:35:44 -0400 (EDT) Received: from oa-res-26-28.wireless.abdn.ac.uk (oa-res-26-28.wireless.abdn.ac.uk [137.50.26.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 9DF898C0080; Wed, 29 Oct 2014 21:35:43 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: <54506D20.3010402@seld.be> Date: Thu, 30 Oct 2014 01:35:41 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <25A333FC-0560-4635-91A6-0E5C229907DA@ajf.me> References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> <544D48A3.6070905@gmail.com> <572FEBD1-99A8-4788-83F9-D99E470FB16D@ajf.me> <544F4321.8040302@seld.be> <544FA716.2030508@gmail.com> <54506D20.3010402@seld.be> To: Jordi Boggiano X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: ajf@ajf.me (Andrea Faulds) > On 29 Oct 2014, at 04:29, Jordi Boggiano wrote: >=20 > Yup that's definitely better than having the readonly flag in the {} = block as I had it. >=20 > I'd however say that it should be possible to define a writable = property with only a getter and then the setter would implicitly be = created. Since readonly is the way to define writability why should I = have to specify a setter (even a default empty one) if none is needed? >=20 > P.S: Don't want to open pandora's box, but we could also have = writeonly for completeness perhaps. I don't really see the use case at = all though (immutability sure, mutant bottomless pit objects not so = much:). I don=E2=80=99t think allowing write-only properties is a good idea if = we need a new keyword for it. To be honest, for such a use case, using a setter method is probably = better than assigning as if it were a normal property. While people = would probably tolerate and understand read-only (from their perspective = outside the class) properties, I think write-only properties will just = lead to poor API design and confusion. -- Andrea Faulds http://ajf.me/