2013/9/26 Joe Watkins <krak...@php.net>

> On 09/26/2013 01:50 AM, Pierre Joye wrote:
>
>> hi!
>>
>> On Sun, Sep 22, 2013 at 11:39 PM, Joe Watkins <krak...@php.net> 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

Reply via email to