Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97376 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33975 invoked from network); 12 Dec 2016 19:19:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2016 19:19:55 -0000 Authentication-Results: pb1.pair.com header.from=marijic.silvio@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marijic.silvio@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.182 as permitted sender) X-PHP-List-Original-Sender: marijic.silvio@gmail.com X-Host-Fingerprint: 209.85.223.182 mail-io0-f182.google.com Received: from [209.85.223.182] ([209.85.223.182:35435] helo=mail-io0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/7E-27518-A58FE485 for ; Mon, 12 Dec 2016 14:19:55 -0500 Received: by mail-io0-f182.google.com with SMTP id h30so187901621iod.2 for ; Mon, 12 Dec 2016 11:19:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=3Yaxn/kwuPwhZ1aEhnF3m+/SG3EowImchijKyvyJ0+k=; b=pIXW9qU3w+OU9Y8o8vbStvZchZwxXHmTGsr1UqaA3Tpv0kayfS8Ttnae0/vMf4mcuH tJ4Ww/xMMSBCLR13g885VN5hZ60MbHk/sp7T9e/zvdLOfrG1SRSiC+UqnmbNrsfgxGHK zbf8eaLpRYj+/edcx1mGAngXPZqua8R0fhP788gB7ZyMhq89JeInu0GXASZTz7f/xxYm Ab4/e0W7DqZufHz2qY22RCHD3wQNu5gYV/vLFVRQNPCVJWNZ5qDE+1EqELBDClBHYEzq EEapDOIhTvgYrc5MODaEltNpOaV6ZvPNdJqggKE5lA5J69UPKAqEgvi81Sv9iACXCf9Y eB6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=3Yaxn/kwuPwhZ1aEhnF3m+/SG3EowImchijKyvyJ0+k=; b=bOvvDHvDTo9UCqaN+NO4FagjsWCx2aoVwrhM+4LoySykhJwMyAWxBQgxRx39AuIVY+ 18a3V9v4s18vb6caB2f5vzUWmU8hzjv3cd8J6tsIn1USP4ATEUtGE6Ed3SnGZP9tp3qQ q/3t478TDKqfdh3Kmh/ZNWG2q8Oj4nVsGQygMbMlOBXgTmWZ4vTxp9ySVWdcng+RDW7e TKoJbGo6NpADSv+CZP/UA4EOImiOYKtEYZuSFvuLwXEoCkKFlEtL2O+kDkMv09vpMCHM QcDdBxhUc+rgVjZhlbLJDnhA+TTQfL/FbaU26z2ApgqywKYTeFYO33KCtVOTyweSmvYc h4jw== X-Gm-Message-State: AKaTC00kRDtEC0v7VMmmIS5ppkH+Y5C0EefnGH+SIr0WLvfqc8HAvXTLp413fnNLJGlBZ6tr8cm/nXixfhbHYg== X-Received: by 10.36.51.76 with SMTP id k73mr11341788itk.22.1481570391244; Mon, 12 Dec 2016 11:19:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.110.142 with HTTP; Mon, 12 Dec 2016 11:19:50 -0800 (PST) In-Reply-To: <2c979395-7b5c-f98e-57a4-ee8b8bd33e74@fleshgrinder.com> References: <2c979395-7b5c-f98e-57a4-ee8b8bd33e74@fleshgrinder.com> Date: Mon, 12 Dec 2016 20:19:50 +0100 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=001a113f6a1ce146c505437afc4b Subject: Re: [PHP-DEV][RFC][DISCUSSION] - Immutable classes and properties From: marijic.silvio@gmail.com (=?UTF-8?Q?Silvio_Mariji=C4=87?=) --001a113f6a1ce146c505437afc4b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable @Fleshgrinder My opinion on that subject is still that features are mostly complete but I'am willing to find also solution to ease modifying. Modify function does not modify object in any way, it will operate on the clone of the object and this was just prototype. Moreover it should be restricted to be only callable from the scope of the object. Introducing method modifier causes more problems then it solves, and has whole another level of complexity. Regarding changing keyword, 'data' does not fit because object is behaviour + data, with behaviour beeing (or at least it should be) at the first place. Value can imply or create confusion with Value Objects, on the other hand immutable clearly states what it is. Cheers, 2016-12-12 19:44 GMT+01:00 Fleshgrinder : > On 12/11/2016 5:57 PM, Silvio Mariji=C4=87 wrote: > > Hi, > > > > Discussion is open for following rfc https://wiki.php.net/rfc/ > immutability > > > > Cheers > > > > -1 from my side for all the things previously mentioned. The > copy-on-write topic must be solved along with the introduction of > immutable classes or we end up with this being implemented and not way > to mutate them in a controlled fashion. > > Also -1 on the proposed `copy` or `modify` function. Not only does it > seem to allow anyone to mutate the immutable object, it also requires > magic strings of the property names. No usage search, no refactoring, no > ... > > I still strongly believe that `__clone` should be made `private` or > `protected` for immutable classes to avoid useless cloning. After that > we either stick to cloning as we currently do in our `with*` methods or > we provide a keyword that changes the behavior of a method. > > I also propose to use `data` or `value` instead of `immutable` as the > class modifier keyword. Its shorter and properly as well as fully > communicates what kind of object we are building. > > -- > Richard "Fleshgrinder" Fussenegger > --=20 Silvio Mariji=C4=87 Software Engineer 2e Systems --001a113f6a1ce146c505437afc4b--