Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56765 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67571 invoked from network); 4 Dec 2011 16:05:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2011 16:05:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.42 as permitted sender) X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.210.42 mail-pz0-f42.google.com Received: from [209.85.210.42] ([209.85.210.42:35396] helo=mail-pz0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/20-65129-E3A9BDE4 for ; Sun, 04 Dec 2011 11:05:18 -0500 Received: by dado14 with SMTP id o14so4514872dad.29 for ; Sun, 04 Dec 2011 08:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=L8q8Er86kq0decAvc3RClfGMoXLzfL5eSK6cv3w1wUQ=; b=ntkjIFAD4fWhKjShtmtawJ08c3iJNVGVTDGFE0WPqbYEXGhJe7lCrQtb6kl7DWeQ+X GpA7V1RJpzzbHW7rLHt4NohtGDpejglw++mxPok/gLQHkA3+khSVjnPl4u+g8/xcf9V9 AhLgB9wP3Slk+yEd6zD+SPYqcKtHG6P/gAOmA= Received: by 10.68.31.129 with SMTP id a1mr15426241pbi.36.1323014715261; Sun, 04 Dec 2011 08:05:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.20.170 with HTTP; Sun, 4 Dec 2011 08:04:54 -0800 (PST) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485399460CA@MBX201.domain.local> <9570D903A3BECE4092E924C2985CE48539946A34@MBX201.domain.local> Date: Sun, 4 Dec 2011 14:04:54 -0200 Message-ID: To: Clint M Priest Cc: Pierre Joye , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Patch: getters/setters syntax Implementation From: felipensp@gmail.com (Felipe Pena) 2011/12/4 Felipe Pena : > Hi, > > 2011/12/4 Clint M Priest : >> Updated patch w/o white-space: http://www.clintpriest.com/patches/access= ors_v1.patch >> >> In the end it is a relatively simple patch. =C2=A0The new syntax effecti= vely creates internal functions on the object and the system looks for thos= e functions and calls them at the appropriate time. >> >> Example: >> class z { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0public $Hours { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0public get { return $this->_Hours; } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0protected set { $this->_Hours =3D $value; } >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> } >> >> Defines: >> $o->__getHours(); >> $o->__setHours($value); >> >> Standard __get()/__set() functionality checks for the more specifically = defined function name and calls them. =C2=A0I thought this would make the m= ost sense since it would allow us to leverage the existing inheritance func= tionality. =C2=A0This comes out with respect to interfaces and traits in th= at only errors had to be changed (for clarity) on interfaces and no changes= to traits were necessary to support the new functionality. >> >> For the automatic get/set functionality, I essentially built the functio= n body myself within zend_do_end_accessor_declaration(). =C2=A0One point of= contention here is that internally it defines a __$Hours property which wo= uld be accessible from various points. =C2=A0I believe the standard C# get/= set does not allow any access to the underlying data storage. =C2=A0In orde= r to accomplish that there would need to be some non-standard storage or a = super-private level or something. =C2=A0I did not explore that possibility = as of yet. >> >> I did add a couple of convenience functions that may already be availabl= e in some other form I was not aware of, such as strcatalloc or MAKE_ZNODE(= ). >> >> --Clint >> >> -----Original Message----- >> From: Pierre Joye [mailto:pierre.php@gmail.com] >> 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 wro= te: >> >>> What are the next steps to get this added to some future release? >> >> Let discuss the =C2=A0implementation and how it works, then you can move= to the voting phase. There is no need to hurry as the next release where t= his patch could go in is next year. >> >> Cheers, >> -- >> Pierre >> >> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > I've fixed the zend_compile.c and zend_object_handlers.c to build with > --enable-maintainer-zts. (some TSRMLS_CC missing and TSRMLS_DC usage > instead of TSRMLS_CC) > Other thing I have noticed that you have not followed our coding > standards about brackets and comments (we don't use the C++ style > one). And about the comments looks as the patch isn't finished or you > just forgot the remove them? > > http://dpaste.com/665851/plain/ > > -- > Regards, > Felipe Pena Check out also the failing tests in Zend/tests/* (including segmentation fa= ult) --=20 Regards, Felipe Pena