Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95794 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50056 invoked from network); 8 Sep 2016 13:27:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Sep 2016 13:27:40 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.19 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.19 mout.gmx.net Received: from [212.227.15.19] ([212.227.15.19:57583] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/2A-36123-84761D75 for ; Thu, 08 Sep 2016 09:27:37 -0400 Received: from [192.168.2.103] ([79.243.115.246]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Lug4m-1b01hp36G0-00zkRF; Thu, 08 Sep 2016 15:27:13 +0200 To: =?UTF-8?Q?Silvio_Mariji=c4=87?= References: <642a6e78-90ea-cbf0-ec1c-376c24e568c5@fleshgrinder.com> <0800a5ca-3d14-c541-1a1a-2574ec802b8c@fleshgrinder.com> <83fa661e-2d3d-6548-a506-fb969be31c0e@garfieldtech.com> <56acc1d9-f424-a460-59be-3a9a1a74b198@fleshgrinder.com> Cc: Mathieu Rochette , Nikita Popov , PHP Internals List , Andrea Faulds , Stephen Reay , =?UTF-8?Q?Micha=c5=82_Brzuchalski?= Message-ID: Date: Thu, 8 Sep 2016 15:27:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:xpoE5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LgNxDlqYCVoz7hwgJtTUYDr X/GgDRz Subject: Re: [PHP-DEV] RFC - Immutable classes From: cmbecker69@gmx.de ("Christoph M. Becker") On 08.09.2016 at 09:41, Silvio Marijić wrote: > I get the nostalgia :) > I think that *zend_compare_symbol_tables* compares only hash tables whether > they contain same properties regardless of the values. What I wanted to show was that PHP 4 objects implemented copy-on-write semantics; the test script doesn't show that, because `===` triggers a value comparision in PHP 4 (didn't know that). However, shows that we had copy-on-write for PHP 4 objects. Cheers! > 2016-09-07 20:44 GMT+02:00 Silvio Marijić : > >> @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" 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 . :-)