Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78430 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64066 invoked from network); 28 Oct 2014 14:24:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2014 14:24:30 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:62095] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/E6-21571-D17AF445 for ; Tue, 28 Oct 2014 09:24:29 -0500 Received: by mail-wg0-f48.google.com with SMTP id m15so971763wgh.31 for ; Tue, 28 Oct 2014 07:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=RfBJfL+vUfFvSmRnQdXUPB9M8btXS/3RjaLgZh+2vIE=; b=a7Hcbjk959tNYhDuIRX9roV74iDcQ+KYw/44bZvx0d3xSAdLwI9/7U6aGRYonN+UYe gMC7obTd+2SVuDpx0Btcr42ZWxuSGG4XHetIhCsBKUfk6LRQdRv+OBPcG0chRpeWISX2 Ia9/NwmWKQyruyWsFfSvA26eZVOPuvGNKjR/LNNVEqYQ0EXA6rCkb9Doras04YQ6POuA TpDkG9hdp8ghzhoa2fQA8Loh+Rp8bh5WoWIUgZOOYIqXPcyjlwvfmviHWAqek+rKeUmY ZBrI2DscU9cgYiZNFjRT4fUsNTakTQoI9YI0ambqzmDNLX1wAdIbUU4/UePJiDpcv1CM U5cw== X-Received: by 10.180.90.65 with SMTP id bu1mr5071168wib.71.1414506266407; Tue, 28 Oct 2014 07:24:26 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id dc8sm2396765wib.7.2014.10.28.07.24.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2014 07:24:25 -0700 (PDT) Message-ID: <544FA716.2030508@gmail.com> Date: Tue, 28 Oct 2014 14:24:22 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> <544D48A3.6070905@gmail.com> <572FEBD1-99A8-4788-83F9-D99E470FB16D@ajf.me> <544F4321.8040302@seld.be> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: rowan.collins@gmail.com (Rowan Collins) Andrea Faulds wrote on 28/10/2014 14:08: >> >On 28 Oct 2014, at 07:17, Jordi Boggiano wrote: >> > >> >I like it, except for the fact that if you add a custom getter to a property suddenly it becomes readonly unless you remember to add "; set" to the end of the block, right? > Well, no. If you choose to specify getters and setters, and only specify a setter, of course it is read-only. It doesn’t make sense to have a getter and no setter and yet expect a property to be writeable. > I think the problem is that the get and set annotations are serving multiple purposes - to change the visibility, to define custom accessor/mutator code, but also to declare whether certain actions are possible at all. Since the default is for the property to be readable and writable, the fact that adding "{ get; }" makes it readonly isn't immediately intuitive, although it does makes sense once you think about it.