Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63668 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43979 invoked from network); 27 Oct 2012 17:52:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2012 17:52:25 -0000 Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; 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:51395] helo=mail.zerocue.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/9B-51104-65F1C805 for ; Sat, 27 Oct 2012 13:52:25 -0400 Received: from [172.17.0.122] (unknown [72.179.52.187]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id 1A25A120812; Sat, 27 Oct 2012 17:52:20 +0000 (UTC) Message-ID: <508C1D07.5070909@zerocue.com> Date: Sat, 27 Oct 2012 12:42:31 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Stas Malyshev CC: PHP Developers Mailing List References: <508A695F.8080308@zerocue.com> <508AA0B8.8090308@sugarcrm.com> In-Reply-To: <508AA0B8.8090308@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Extra shorthand declaration From: cpriest@zerocue.com (Clint Priest) On 10/26/2012 9:39 AM, Stas Malyshev wrote: > Hi! > >> /* Would be equivalent to this */ >> >> class TimePeriod { >> public $date { >> get() { return $this->date; } >> set(DateTime $value) { $this->date = $value;} >> } >> } > I don't think this has a use case and this encourages mixing variables > with properties (which I'm not sure is a very good idea) and writing > slower and more complicated code which doesn't actually do any > additional work. I'd rather not encourage it. If you want it - fine, > implement it, but I don't think supporting it is good. I would agree that it should not be in here, AFAIK only Nikita was pushing for this... anyone else want to fight to have this functionality? > Also, "get() { return $this->date; }" implies there is a thing called > "$this->date" which is not the property itself. So what is it? Should > there be additional "public $date;" declaration in your code? Is it > implied that property definition also creates a variable inside class > automatically - I was under expression this does not happen, and nothing > in the RFC implies it. Should it be $this->__date maybe like in > "automatic accessors" part of the RFC? This is related to accessors shadowing properties, if that's the case then $this->date would retrieve an actual property named date (and since it's shadowed by the accessor it could never be accessed from outside the accessor. See the shadowing thread. -- -Clint