Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15587 invoked from network); 26 Sep 2013 10:45:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2013 10:45:51 -0000 X-Host-Fingerprint: 80.4.21.210 cpc22-asfd3-2-0-cust209.1-2.cable.virginmedia.com Received: from [80.4.21.210] ([80.4.21.210:26603] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/FC-46303-E5014425 for ; Thu, 26 Sep 2013 06:45:50 -0400 To: internals@lists.php.net,Lazare Inepologlou Message-ID: <5244105A.7050707@php.net> Date: Thu, 26 Sep 2013 11:45:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 References: <5243F19F.3060307@php.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 80.4.21.210 Subject: Re: [PHP-DEV] RFC: Anonymous Classes From: krakjoe@php.net (Joe Watkins) On 09/26/2013 11:38 AM, Lazare Inepologlou wrote: > 2013/9/26 Joe Watkins > >> On 09/26/2013 01:50 AM, Pierre Joye wrote: >> >>> hi! >>> >>> On Sun, Sep 22, 2013 at 11:39 PM, Joe Watkins wrote: >>> >>>> Morning All, >>>> >>>> https://wiki.php.net/rfc/**anonymous_classes >>>> >>>> I'd like to hear thoughts regarding the addition of anonymous classes, >>>> patch included. >>>> >>> >>> Thanks for your proposal and work. >>> >>> If you did not yet update your RFC I would suggest to do so, it is about >>> the right time. >>> >>> Adding already answered questions, more use cases (read a couple of good >>> ones in this thread). It will help to end in circular discussions or >>> arguing. >>> >>> Cheers, >>> Pierre >>> >>> >> Thanks ... >> >> I have made many changes to the RFC and patch since the beginning of this >> discussion ... >> >> It might be useful if you could all now go back to the RFC for another >> read, point out anything I've left unclear at this point. >> >> > > Thank you for the updates. > > There is a possible mistake in the "Inheritance" section. The $this->data > array is passed by value to the constructor of the anonymous class. Once > there is any change to the initial array, the two classes will contain > different data. > > Which leads us to the point that this pattern is not enough to do what you > wanted to without changing the original constructor. This is usually out of > the question, as one such change will also change the outer class' behavior. > > We don't have to reinvent the wheel here. The solution is some kind of > "use" clause that works similarly to the anonymous functions. > > > Cheers, > > Lazare INEPOLOGLOU > Ingénieur Logiciel > We don't have to re-invent the wheel, pass by reference if that's what you want to do, the example didn't make any changes to data, tests included with the patch do, and it, of course, works ... Cheers