Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63171 invoked from network); 4 Dec 2011 15:05:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2011 15:05:47 -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:58699] helo=mail-pz0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/09-13454-94C8BDE4 for ; Sun, 04 Dec 2011 10:05:46 -0500 Received: by dado14 with SMTP id o14so4466602dad.29 for ; Sun, 04 Dec 2011 07:05:42 -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=CltjZ6DsTj+wMv3HGSWK4p/PKZCKzUqggdlCK2Z6C1U=; b=EY19gaWFSZzwH01zWFgD2wb5TisgTx+fhLctuVC3jVe/y+nuSvDxJUTitqDddZK1Z8 wDm4zxGJyEKHVghgm94u7oJVgDQgOMDjBq5AUaCv04OmriiyZwg40JXcOtC+A7Kh2RoJ 8MNn9o+uSMvzxgDelYt+oyKeQEi0jviLid928= Received: by 10.68.35.103 with SMTP id g7mr15010089pbj.53.1323011142250; Sun, 04 Dec 2011 07:05:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.20.170 with HTTP; Sun, 4 Dec 2011 07:05:21 -0800 (PST) In-Reply-To: <9570D903A3BECE4092E924C2985CE48539946A34@MBX201.domain.local> References: <9570D903A3BECE4092E924C2985CE485399460CA@MBX201.domain.local> <9570D903A3BECE4092E924C2985CE48539946A34@MBX201.domain.local> Date: Sun, 4 Dec 2011 13:05:21 -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) Hi, 2011/12/4 Clint M Priest : > Updated patch w/o white-space: http://www.clintpriest.com/patches/accesso= rs_v1.patch > > In the end it is a relatively simple patch. =C2=A0The new syntax effectiv= ely creates internal functions on the object and the system looks for those= 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 d= efined function name and calls them. =C2=A0I thought this would make the mo= st sense since it would allow us to leverage the existing inheritance funct= ionality. =C2=A0This comes out with respect to interfaces and traits in tha= t 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 function= body myself within zend_do_end_accessor_declaration(). =C2=A0One point of = contention here is that internally it defines a __$Hours property which wou= ld be accessible from various points. =C2=A0I believe the standard C# get/s= et does not allow any access to the underlying data storage. =C2=A0In order= to accomplish that there would need to be some non-standard storage or a s= uper-private level or something. =C2=A0I did not explore that possibility a= s of yet. > > I did add a couple of convenience functions that may already be available= 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 wrot= e: > >> 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 th= is 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/ --=20 Regards, Felipe Pena