Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64508 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89638 invoked from network); 3 Jan 2013 19:38:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2013 19:38:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=steve@mrclay.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=steve@mrclay.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mrclay.org from 50.22.11.19 cause and error) X-PHP-List-Original-Sender: steve@mrclay.org X-Host-Fingerprint: 50.22.11.19 bedford.accountservergroup.com Linux 2.6 Received: from [50.22.11.19] ([50.22.11.19:51770] helo=bedford.accountservergroup.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/64-01104-94ED5E05 for ; Thu, 03 Jan 2013 14:38:50 -0500 Received: from n128-227-98-14.xlate.ufl.edu ([128.227.98.14]:50699 helo=Distance-Ed-Sclay.local) by bedford.accountservergroup.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1Tqqcj-000FxV-0L for internals@lists.php.net; Thu, 03 Jan 2013 13:38:46 -0600 Message-ID: <50E5DE40.7010408@mrclay.org> Date: Thu, 03 Jan 2013 14:38:40 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: internals@lists.php.net References: <50E41BB6.4030901@zerocue.com> <50E4A43E.6030302@zerocue.com> <50E4B232.5000505@mrclay.org> <50E4BDDE.8050509@zerocue.com> <50E4D0BB.7060701@mrclay.org> <50E4FA09.7030001@zerocue.com> <50E529B6.1050903@sugarcrm.com> <50E56450.1060801@zerocue.com> <50E5A4DB.2000205@mrclay.org> <50E5B4B4.50705@zerocue.com> In-Reply-To: <50E5B4B4.50705@zerocue.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bedford.accountservergroup.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - mrclay.org Subject: Re: [PHP-DEV] [PHP-RFC] Property Accessors 1.2 for Final Review before Vote From: steve@mrclay.org (Steve Clay) On 1/3/13 11:41 AM, Clint Priest wrote: >> class Foo { >> private $realbar; >> >> public $bar = 2 { >> get { return $this->realbar; } >> set { $this->realbar = $value; } >> } >> } >> > What would be the point of this? I think it would be more readable for someone using the class. As a user it helps to know the default of the property I'll actually be interacting with. In a non-trivial getter the default may be much harder to tease out. But yes, I agree that it's straightforward enough for the class author to set defaults as needed, so I see no problem moving forward. The RFC should make clear that only the shadow value is set (a setter, if present, is not used). In the features docs I suggest finding a term for a non-traditional property, like "guarded property". Also I think you should eliminate all "shadowing" language. IMO it adds more confusion than it removes. Here's some language that may/may not be useful: Almost all interaction with a guarded property is "proxied", meaning the getter and setter methods are used instead of direct reading/writing of the value. There are only two exceptions: 1. Within a getter's scope, reads are not proxied: the property is read directly. 2. Within a setter's scope, writes are not proxied; the property is written to directly. Accessors are free to interact with other properties which are visible to them, but access to other guarded properties is always proxied. Accessors are not required to use the property value, but it always exists. Steve Clay -- http://www.mrclay.org/