@Christoph

I get the nostalgia :)
I think that *zend_compare_symbol_tables* compares only hash tables whether
they contain same properties regardless of the values.

2016-09-07 20:44 GMT+02:00 Silvio Marijić <marijic.sil...@gmail.com>:

> @Fleshgrinder
>
> I will make changes that if immutable objects are being compared that they
> will be compared by value rather then hash
> On Sep 7, 2016 8:27 PM, "Christoph M. Becker" <cmbecke...@gmx.de> wrote:
>
>> On 07.09.2016 at 20:11, Fleshgrinder wrote:
>>
>> > On 9/7/2016 8:57 AM, Michał Brzuchalski wrote:
>> >
>> >> AFAIK CoW in case of objects would be impossible to implement.
>> >
>> > Nothing is impossible. :)
>> >
>> > We have full access to the real object inside of zend_std_write_property
>> > and can easily clone it, perform the desired changes and return without
>> > affecting anyone.
>> >
>> > I am not 100% sure how to do this without fiddling around a bit.
>> >
>> > @nikic and @afaults: I am really sorry to bother you both but you guys
>> > simply know the PHP source endlessly good. What do you think, would it
>> > be possible to implement copy-on-write for an object as we have it with
>> > our scalar and compound types?
>> >
>> >     final class A {
>> >       public $p;
>> >     }
>> >
>> >     $a = new A;
>> >     $b = $a;
>> >
>> >     var_dump($a === $b); // bool(true)
>> >
>> >     $b->p = 1;
>> >
>> >     var_dump($a === $b); // bool(false)
>> >
>> > It's only about writing to existing properties.
>>
>> Ah, good old PHP 4, see <https://3v4l.org/VaD1W#v5328>. :-)
>>
>> --
>> Christoph M. Becker
>>
>>


-- 
Silvio Marijić
Software Engineer
2e Systems

Reply via email to