Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50018 invoked from network); 29 Oct 2012 21:56:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Oct 2012 21:56:10 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.173 smtp173.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.173] ([67.192.241.173:57960] helo=smtp173.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/B1-31721-97BFE805 for ; Mon, 29 Oct 2012 16:56:10 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp7.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 4C4F9258177; Mon, 29 Oct 2012 17:56:07 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp7.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id D730E2583A8; Mon, 29 Oct 2012 17:56:06 -0400 (EDT) Message-ID: <508EFB76.4080604@sugarcrm.com> Date: Mon, 29 Oct 2012 14:56:06 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Nikita Popov CC: Clint Priest , PHP Developers Mailing List References: <508A67E6.2000405@zerocue.com> <508A9AC9.50200@sugarcrm.com> <508AF3E7.7020004@sugarcrm.com> <508B1EA2.8060203@sugarcrm.com> <508C249D.1000309@zerocue.com> <508C43ED.9000209@sugarcrm.com> <508C80C6.9000008@zerocue.com> <508CD916.1070509@sugarcrm.com> <508D5462.4070503@zerocue.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > If I got it right now, what Stas wants is that we introduce __getFoo > and __setFoo methods that will be called whenever an undefined ->foo > property is accessed and that the "normal" property accessors syntax > is made nothing more than a fancy notation for this. Yes, pretty much, though "undefined" bit is not required I think. Not 100% convinced on this, but from user reqs it sounds like they want to drop the undefined bit. > A) Inheritance: > ========== > > class A { > public $foo; > } > > class B extends A { > public $foo { get() { ... } set($value) { ... } } > } > > => With the accessors syntax there is an expectation that the accessor > declaration will override the previous plain property. At least that's > what I would expect and that's what the code looks like That's why I'm not liking the "undefined" bit. > => With the magic syntax there is the expectation that the $foo > property will not be overridden. Rather the magic functions are > expected to do nothing, because the property already exists. Err, I'm not sure why that would be the expectation. __get is for undefined properties, since, well, it doesn't have any property name attached, so it can't really be for defined properties :) However, __getFoo (with whatever variations the bikeshedding committee will end up with :) has property name attached to it, so requiring property be undefined is not, well, required. Here we need to think which way is better, and I currently tend to think accessor priority is better. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227