Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64487 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32765 invoked from network); 2 Jan 2013 21:18:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2013 21:18:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 67.200.53.250 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 67.200.53.250 mail.zerocue.com Received: from [67.200.53.250] ([67.200.53.250:49897] helo=mail.zerocue.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/60-12868-934A4E05 for ; Wed, 02 Jan 2013 16:18:49 -0500 Received: from [172.16.10.217] (unknown [97.79.213.78]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id 15FA81203A3; Wed, 2 Jan 2013 21:18:45 +0000 (UTC) Message-ID: <50E4A43E.6030302@zerocue.com> Date: Wed, 02 Jan 2013 15:18:54 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Philip Graham CC: PHP Developers Mailing List References: <50E41BB6.4030901@zerocue.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PHP-RFC] Property Accessors 1.2 for Final Review before Vote From: cpriest@zerocue.com (Clint Priest) On 1/2/2013 12:44 PM, Philip Graham wrote: > I am confused by one thing about the RFC. There is a section for default > accessor implementations where you specify an accessor without a body, > however many of the examples omit the isset and unset accessors. I would > assuming that omitting an accessor would provide the automagic > implementation. If this is the case what is the need for the special > syntax? If this is not the case then what is the effect of omitting an > accessor? Omitting get/set declaration (and body) makes the property read only or write only. Omitting isset/unset has the same effect as declaring it without a body. This is described in the RFC under Automatic Implementations with this line: Note that isset/unset implementations will always be provided if they are not defined or if they are explicitly auto-defined (as above). > > I do see that omitting the setter creates a read-only property, however I > think the syntax would be less ambiguous and easier to use by introducing a > `readonly` keyword: > > class MyClass > { > public readonly $myProp { > // ... > } > } > > This would also eliminate the need for additional syntax for default > accessors. There is one problem I see with this however, what happens when > a setter is provided for a readonly property? > > If this has already been discussed, please accept my apologies and maybe > provide a link to the discussion. This point of contention was discussed ad nauseam and nobody wanted the read-only/write-only keywords, they were removed from 1.1 -> 1.2 Please see this document: https://wiki.php.net/rfc/propertygetsetsyntax-as-implemented/change-requests Which documents all points of contention from 1.1 and what their resolution was. > > Regards, > Philip > > On Wed, Jan 2, 2013 at 6:36 AM, Clint Priest wrote: > >> Here is the updated RFC incorporating the feedback from previous rounds of >> discussion. >> >> https://wiki.php.net/rfc/**propertynot getsetsyntax-v1.2 >> >> I'm posting it for final review so I can move to voting on Jan 7th. >> >> Please note that the current fork is not quite up-to-date with the RFC but >> will be within a few more days. >> >> -Clint >> >> -- >> -Clint >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> -- -Clint