Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101933 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89721 invoked from network); 26 Feb 2018 15:57:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2018 15:57:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=crocodile2u@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=crocodile2u@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: crocodile2u@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-ua0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:36119] helo=mail-ua0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/03-60937-E5E249A5 for ; Mon, 26 Feb 2018 10:57:18 -0500 Received: by mail-ua0-f170.google.com with SMTP id i15so10866371uak.3 for ; Mon, 26 Feb 2018 07:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Oxh0LO5QtkCLcdRcJF0440+Oihq3DgTjraXUCucPoy8=; b=Zie1MpEZQ+ab8U4G0CzmoN08PIQqWUGEUmF52paweuCVqbCFnCDSlo8JXutc4jVX91 2vplkeLVxkNdiuHkxF25rU1SPPCX5koXwfRD20pkLLXVSO4Ag/tqhMXSp6c/vNVvjLdg 0UsKBUFEOeoL4ig7iZ9sthk4kgO7XYiyuXNimVhs0HITVquOu/Z0lsrTu0/zSw8D1Gel zRXtQ35Fj6RVOOT4QGvefGm05hLfsg5w4k8ZmcdQPc1S6dMGx0ZQiTd4L9/j2cH440X4 ayNRa6EneN2Z8vC+D6ij+XSPBMwc1TlNkKNnixTc4RYnFjOkM8JUXCgU+kqwKkgidgFK hp+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Oxh0LO5QtkCLcdRcJF0440+Oihq3DgTjraXUCucPoy8=; b=M54s/BntIf//lsmLCLkAPEGrWxIR+ziK/8ZgYz92zLSLYsTx+3/qhoZjmz+eeQF35f KPajSBlXNsIcAxS4l3gTUF2cBKhX+irvSSSsFp3C39Bn8uSkM1mly4m66lGW+scctpM6 WxUjvgRPZ+nmoOSeVxv6YuNyaSNKPlBHpSBZJGbG7oAhA+Kujk1hjpiAKmmm29r7yz/J 8mPYBCCgUqtEHiRXJMqfPuLwiGZ4tMmNbnJCqZh0/5ZI721QQBfVCU3+hhMyH9PL9uwD uK9+0BcJ7GzESUV6Vob1ebj7x5h8GbzBEG0sVhE4PCC7vXRbZkm0DpvL/MAskzlzt0J2 hEQw== X-Gm-Message-State: APf1xPA/HYE/J9IRbC9NL6aKDmbHN4JzpjH9DASbF1mYZVlhFLhn3V1e WfEAR/CFdrJj42RsU7y+Tw1lbeHJtEBn/ddEsa4= X-Google-Smtp-Source: AG47ELt0oZEDM0N56tTyyLvXtsnkK99pX6PUodIud74stukxPr/MvL1eIkP+agyctzU3QaG+cfZC8XpwsBPkIyJptio= X-Received: by 10.176.19.132 with SMTP id m4mr8976040uae.197.1519660635974; Mon, 26 Feb 2018 07:57:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 26 Feb 2018 15:57:04 +0000 Message-ID: To: Andreas Hennings Cc: =?UTF-8?Q?Silvio_Mariji=C4=87?= , PHP Internals List Content-Type: multipart/alternative; boundary="001a114562d662f1b505661f9058" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Immutability From: crocodile2u@gmail.com (Crocodile) --001a114562d662f1b505661f9058 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Nice one by Andreas Hennings, I think! I personally have also question on deserialization of immutables. Is it going to be possible at all? Another thing is that PDO will probably not be able to use FETCH_CLASS with immutables, because of the way it initializes properties. On Mon, Feb 26, 2018 at 4:13 PM Andreas Hennings wrote: > Hello, > my thoughts. > For me personally the proposed feature would not be very useful. > i like immutable objects. But for me the pattern of choice is private > properties + constructor + optional "wither" methods. > > The "wither" methods create a clone of the object, then set a property > value on the clone, then return the clone. > This would already not work if the property is marked as immutable > with the proposed feature. > > Also static method constructors that write directly on the object > would not work, because technically they are not part of the > constructor. > > For private properties the proposed feature would add little benefit. > Any private property can be made practically immutable by writing the > class accordingly: Not having setters, etc. > > Where this feature would become useful is if someone prefers public > properties over getter methods. > But again, this would prevent any unconventional constructor, like > withers or static factories. > > I think a better and more useful feature would be read-public, > write-private. > Maybe like this? https://wiki.php.net/rfc/readonly_properties > (For some reason I cannot open the RFC wiki pages. Maybe they are down?) > > This would achieve the same goal: Making a property practically immutable= . > But it would still allow unconventional constructors. > It would be the implementor's job to decide which method should be > allowed to modify a property, and which shouldn't. > > > > On 26 February 2018 at 13:52, Silvio Mariji=C4=87 > wrote: > > Currently the build is failing in some parts of the codebase that are > > obviously affected in some way. > > I ran valgrind for couple of failing tests and I got numerous reports > about > > memory leaks and conditional jumps over uninitialized values. > > Not sure what is the reason for that, I had merge conflict with upstrea= m > > master couple days ago, might be a reason. > > > > I would appreciate if anyone could give me hand on this ? > > > > On Feb 26, 2018 1:48 PM, "Silvio Mariji=C4=87" > wrote: > > > >> Currently the build is failing in some parts of the codebase that are > >> obviously affected in some way. > >> I ran valgrind for couple of failing tests and I got numerous reports > >> about memory leaks and conditional jumps over uninitialized values. > >> Not sure what is the reason for that, I had merge conflict with upstre= am > >> master couple days ago, might be a reason. > >> > >> I would appreciate if anyone could give me hand on this ? > >> > >> On Feb 26, 2018 1:44 PM, marijic.silvio@gmail.com wrote: > >> > >> Yes, I've also took that into consideration when choosing keyword. > >> > >> On Feb 26, 2018 11:35 AM, "Crocodile" wrote: > >> > >> Is "value" or "immutable" going to become a new reserved word? Ain't w= e > >> going to have some BC breaks because of that? If so, then "value" is > going > >> to bring more BC breaks then "immutable". > >> > >> On Sun, Feb 25, 2018 at 8:02 PM Paul Jones wrote= : > >> > >>> > >>> > >>> > On Feb 25, 2018, at 12:59, Silvio Mariji=C4=87 > >>> wrote: > >>> > > >>> > Here is link to tweet https://twitter.com/SilvioMari > >>> jic/status/965564630071300096 > >>> > >>> After having read that, I think "immutable" is still perfectly > reasonable. > >>> > >>> > >>> -- > >>> Paul M. Jones > >>> pmjones@pmjones.io > >>> http://paul-m-jones.com > >>> > >>> Modernizing Legacy Applications in PHP > >>> https://leanpub.com/mlaphp > >>> > >>> Solving the N+1 Problem in PHP > >>> https://leanpub.com/sn1php > >>> > >>> > >>> > >>> > >>> -- > >>> PHP Internals - PHP Runtime Development Mailing List > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >>> -- > >> Best regards, > >> Victor Bolshov > >> > >> > >> > >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best regards, Victor Bolshov --001a114562d662f1b505661f9058--