Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56760 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54928 invoked from network); 4 Dec 2011 14:09:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2011 14:09:25 -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 74.115.204.53 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.53 relay-hub203.domainlocalhost.com Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [74.115.204.53] ([74.115.204.53:16528] helo=relay-hub203.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/77-13454-21F7BDE4 for ; Sun, 04 Dec 2011 09:09:24 -0500 Received: from MBX201.domain.local ([169.254.1.105]) by HUB203.domain.local ([74.115.204.53]) with mapi id 14.01.0289.001; Sun, 4 Dec 2011 09:09:20 -0500 To: Pierre Joye CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Patch: getters/setters syntax Implementation Thread-Index: AcyyHFLpWHG9PY58StafgrdW825OtwAgAByAAAPPM+A= Date: Sun, 4 Dec 2011 14:09:18 +0000 Message-ID: <9570D903A3BECE4092E924C2985CE48539946A34@MBX201.domain.local> References: <9570D903A3BECE4092E924C2985CE485399460CA@MBX201.domain.local> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.64.27] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Patch: getters/setters syntax Implementation From: cpriest@zerocue.com (Clint M Priest) Updated patch w/o white-space: http://www.clintpriest.com/patches/accessors= _v1.patch In the end it is a relatively simple patch. The new syntax effectively cre= ates internal functions on the object and the system looks for those functi= ons and calls them at the appropriate time. Example: class z { public $Hours { public get { return $this->_Hours; } protected set { $this->_Hours =3D $value; }=20 } } Defines: $o->__getHours(); $o->__setHours($value); Standard __get()/__set() functionality checks for the more specifically def= ined function name and calls them. I thought this would make the most sens= e since it would allow us to leverage the existing inheritance functionalit= y. This comes out with respect to interfaces and traits in that only error= s had to be changed (for clarity) on interfaces and no changes to traits we= re necessary to support the new functionality. For the automatic get/set functionality, I essentially built the function b= ody myself within zend_do_end_accessor_declaration(). One point of content= ion here is that internally it defines a __$Hours property which would be a= ccessible from various points. I believe the standard C# get/set does not = allow any access to the underlying data storage. In order to accomplish th= at there would need to be some non-standard storage or a super-private leve= l or something. I did not explore that possibility as of yet. I did add a couple of convenience functions that may already be available i= n some other form I was not aware of, such as strcatalloc or MAKE_ZNODE(). = =20 --Clint -----Original Message----- From: Pierre Joye [mailto:pierre.php@gmail.com]=20 Sent: Sunday, December 04, 2011 4:50 AM To: Clint M Priest Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Patch: getters/setters syntax Implementation hi Clint! Thanks for your work so far! On Sun, Dec 4, 2011 at 1:33 AM, Clint M Priest wrote: > What are the next steps to get this added to some future release? Let discuss the implementation and how it works, then you can move to the = voting phase. There is no need to hurry as the next release where this patc= h could go in is next year. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org