Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65017 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2293 invoked from network); 17 Jan 2013 22:24:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2013 22:24:41 -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:36221] helo=bedford.accountservergroup.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/00-01699-62A78F05 for ; Thu, 17 Jan 2013 17:24:39 -0500 Received: from n128-227-83-34.xlate.ufl.edu ([128.227.83.34]:64491 helo=Distance-Ed-Sclay.local) by bedford.accountservergroup.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1Tvxsy-0006L8-0b for internals@lists.php.net; Thu, 17 Jan 2013 16:24:36 -0600 Message-ID: <50F87A23.60808@mrclay.org> Date: Thu, 17 Jan 2013 17:24:35 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: PHP Internals References: <50F840F4.7080704@zerocue.com> In-Reply-To: <50F840F4.7080704@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] [VOTE] Property Accessors for 5.5 From: steve@mrclay.org (Steve Clay) On 1/17/13 1:20 PM, Clint Priest wrote: > I'm happy to say that Property Accessors is ready for a vote for inclusion in 5.5 release. > > Nikita and I (as well as Stas a bit) have all been working hard to make this happen for > 5.5, voting and the specifications are here: > https://wiki.php.net/rfc/propertygetsetsyntax-v1.2#voting I'll say my peace on this. This is a very good implementation, and as long as authors use accessors that depend on a separate property for storage (like other langs require), everything will be straightforward. Otherwise, I fear they're in for some confusing behavior. Consider the code from the RFC: class TimePeriod { public $Hours { get { return $this->Hours ?: "not specified"; } set { $this->Hours = $value; } } } $tp = new TimePeriod(); $tp->Hours; // "not specified" isset($tp->Hours); // true!? The auto implementation of isset compares $this->Hours to NULL, but since $this->Hours goes through the getter, it will return "not specified". So the property will always appear to be isset. * The guards seem spooky: A set of tokens ($this->prop) will have varying behavior (e.g. direct prop read vs. getter call) *depending on the call stack*. * Giving issetter/unsetter no direct access to the property limits functionality and leads to weirdness like the example above. Steve Clay -- http://www.mrclay.org/