Re: RFC: Anonymous Classes

From: Date: Thu, 26 Sep 2013 10:45:46 +0000
Subject: Re: RFC: Anonymous Classes
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 09/26/2013 11:38 AM, Lazare Inepologlou wrote:
2013/9/26 Joe Watkins <[email protected]>
On 09/26/2013 01:50 AM, Pierre Joye wrote:
hi! On Sun, Sep 22, 2013 at 11:39 PM, Joe Watkins <[email protected]> wrote:
Morning All, https://wiki.php.net/rfc/**anonymous_classes<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

Thread (55 messages)

« previous php.internals (#69350) next »