Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97365 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4444 invoked from network); 12 Dec 2016 14:14:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2016 14:14:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.68 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.68 mail-wm0-f68.google.com Received: from [74.125.82.68] ([74.125.82.68:35129] helo=mail-wm0-f68.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/59-27518-8C0BE485 for ; Mon, 12 Dec 2016 09:14:33 -0500 Received: by mail-wm0-f68.google.com with SMTP id a20so11546599wme.2 for ; Mon, 12 Dec 2016 06:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:message-id; bh=BJRTHzsit6jAbXSgEpjbziMJDb8kdb5LJx6y5d+Ejrs=; b=DMAGSgMzsJAmjKf97bGdszDlC//3H0m8JufjNcXHCYgdeTiXcjPn3aZk7cedrzFe0h IDxQBUtl0SrM3xUlK7Pg/dNMntpiIC/S4oHlLD2P+nw8tL95KXihlAFOuJGGgZ4/PSFu jGQGxEY25sBbV8ZifawpmHmZQPbRlkv3pDOUe5h5GQAvR6u/01wDB6OYv8I4t4WDsdej ZKUkFOJwMy3AwbgqXvGifNic/VRmv7UsmJtfDEvgoUWNJuXie2tz7E45Es2A6LDUcI7j sx3zNq/N6o4yhRODqFuAUSaw/xz0o/8Ej66Extu5fHg6iNWr/Q9jPw3HWnwtmtpwfWr9 gaIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:message-id; bh=BJRTHzsit6jAbXSgEpjbziMJDb8kdb5LJx6y5d+Ejrs=; b=m/iR6uO4Duxh1i2ZxXzlkzR0YIXJWcp7t/CbIpwTmc7Be+N9BXAks4FFLlOiJwIMB/ bgGL1pdekl/81ljlpAnDu58S9OvFFpiMhv20W1NkLGQQjjfdnarckII8SMFa3BXeuOEb 4nr6NOx1LmpyUYjTsQlWkZM4BhHi7wBlKgWzz2Oa1ZDtfJxZvVdbDUTVhPVcPRfbYQVI 7WVOEIJA3vFWprrivsCo6vm8vrY/OAra2yO1dKY7LbVZFFU7V0tI2JLvoHdvJH75JI/l 0szfegkSEBBOIJTVxaSlKGdlWwKW6Xcfu/X+0aVSaUX2owW/OTl0syo3XeLvMKNkKWlS ZZbA== X-Gm-Message-State: AKaTC03qRL9LjSjbVNiupfPe6J3snl9WOu5TYZ9Z5saUIgkXUBY3rwKgN9wjadPOoEJoug== X-Received: by 10.28.167.77 with SMTP id q74mr17238130wme.21.1481552069954; Mon, 12 Dec 2016 06:14:29 -0800 (PST) Received: from broadband.bt.com ([2a00:23c4:4bd2:6e00:61cf:8c65:db91:382]) by smtp.gmail.com with ESMTPSA id a13sm35793463wma.18.2016.12.12.06.14.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 06:14:28 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: References: <1807f949-81d3-f2c4-8706-0fdade3ea51d@garfieldtech.com> <4635ac4b-844a-b023-5ad9-e8524a156404@texthtml.net> <79ea244b-9fe7-5b05-d429-bf5585215542@texthtml.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Mon, 12 Dec 2016 14:14:26 +0000 To: PHP Internals List Message-ID: <76C07EDB-56B3-46AB-A5C1-92485B32C113@gmail.com> Subject: Re: [PHP-DEV][RFC][DISCUSSION] - Immutable classes and properties From: rowan.collins@gmail.com (Rowan Collins) On 12 December 2016 09:11:17 GMT+00:00, "Silvio Marijić" wrote: >Regarding my proposal above, since copy() would essentially operate >only on >immutable objects, why not put it only there. So you would be able to >make >a call like this one $immutable->copy(array $args); or >$this->copy(array >$args); depending on whether you are inside let's say with* method or >outside of the object. If users of the object can set arbitrary (public) properties this way, then you've thrown away a bunch of the free encapsulation the immutable keyword gave you in the first place. What you get is an enforced copy-on-write, where you can set the properties to whatever state you like, just not using normal object passing semantics. That's very different from what the RFC shows, which are properties which are publicly readable, but whose state is exclusively controlled by the class (and its descendants). PS The rule on this mailing list is too always reply *below* the text you're replying to. -- Rowan Collins [IMSoP]