Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101911 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17964 invoked from network); 23 Feb 2018 14:47:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2018 14:47:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.163 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.163 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.163] ([81.169.146.163:21200] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/36-01511-079209A5 for ; Fri, 23 Feb 2018 09:47:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1519397229; s=strato-dkim-0002; d=kelunik.com; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:X-RZG-CLASS-ID:X-RZG-AUTH; bh=lW+2pRiNXmWCXzKWO6C0tZaqXHCpmiTQMlx06mYUfeE=; b=Bq1zh3vU44cbPAH5osP8KnJ8tr2za39v4U+aShD/WwjjqV15CWrTlkLfES/Cm3/zha twGhKTSCNj6xi1avbbdhi01EAQc+a7E/PeGEEYJ93PBimi4PcWYXblvG8v2Cb3rSybgS HzsJojwHwO4PjBTcPNwzqipSy9/q+0abyyLAAPlQuvpwW7+i9iwzjbzFmNtyzfvlmdCs 9rTYOTx2iae4r37W7X8pfzBlPh26Vh+OEqMsnyjI6BV6IETmG8NHTFvEVR9G0lbWwnX6 FeRK2LHLC8NNjRqtrcKxUOANwgyzWalI82hGhOeAhGBOywSw5bxmOOVtcZtZhAFHSgWa /W+g== X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mlsGbEv0XHBzMIJSS+jKTzde5mDb8AaBUcZi8ucA== X-RZG-CLASS-ID: mo00 Received: by mail-yb0-f182.google.com with SMTP id i15-v6so2946100ybg.7 for ; Fri, 23 Feb 2018 06:47:09 -0800 (PST) X-Gm-Message-State: APf1xPDw/V0RYz2ZaNAk9TLSM4qVZvjKNscVBwag9JiKYLl6Kom/qdld /7JO02junrdZAqxl18ykG3uoJBRIfHSnERfFgN8= X-Google-Smtp-Source: AG47ELscl66xqDXYPT1QWCfn2Tfj491QXanHHB0fi9JQG/i7hNT4W9nAYdFLUhs2D5zzF1fBWVhuXmCT0ScxiBDdVZ4= X-Received: by 2002:a25:ad08:: with SMTP id y8-v6mr1171101ybi.35.1519397228880; Fri, 23 Feb 2018 06:47:08 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:a04a:0:0:0:0:0 with HTTP; Fri, 23 Feb 2018 06:47:08 -0800 (PST) In-Reply-To: References: <2B23EFFB-21C3-49E4-9000-B2E0F97E93A2@gmail.com> Date: Fri, 23 Feb 2018 15:47:08 +0100 X-Gmail-Original-Message-ID: Message-ID: To: =?UTF-8?Q?Silvio_Mariji=C4=87?= Cc: Paul Jones , PHP Internals List Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Immutability From: me@kelunik.com (Niklas Keller) Hey, > I do have rough idea how to go about arrays possibly without recursive > scan, I have to try couple of things, it could work if some checks are > moved to zval level. For now it is in the future scope unless I manage to > handle the within week or two. What's the issue with a one-time runtime check on assignment? > First two proposals are valid points. Regarding disabling constructor, that > would fail as soon as you try to write properties in constructor since > object is already "locked". You lock the object after the constructor has been called, not afterwards. If you don't do that, your objects won't be immutable. I like the RFC, but generally I think value objects that are passed by-value instead of by-reference are the better way to solve the problem. Regards, Niklas