Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97075 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91680 invoked from network); 19 Nov 2016 19:28:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2016 19:28:20 -0000 Authentication-Results: pb1.pair.com header.from=michal.brzuchalski@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michal.brzuchalski@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: michal.brzuchalski@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:36258] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/00-25987-FC7A0385 for ; Sat, 19 Nov 2016 14:28:18 -0500 Received: by mail-wm0-f47.google.com with SMTP id g23so86389492wme.1 for ; Sat, 19 Nov 2016 11:28:15 -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 :cc; bh=XEyySr/AH0rK8wfg6NBkqlU01iaFJRQVLnor9GHGvIk=; b=jnYw4TN8ldBy5pDudqGv3Ax+fQEvo/kd29uRgm6W5hBf/WPYvR4v+4Sd+ZYZ0emHKM fLrkVAIW9Frydg6P0axg4c5/+F4UkghFdUqo/V+SjYWGGlrSoJh+RzHqJeQ0atk9A6Wg /+Rb+Zb8vqj7fvy47+tUXeMKx4/a5mbTcPua10eJUhX6GZOO7HkqgME0hg3opftsOGYs tfzXs/4ywfIL7UD+9k0D3R1IWyCzXGkUCJx0aqzV1wxEqKeLygGhBX1uuHQp20p4HoN5 irQ7eGaGTWGdiJaWOlswImE7+YsTOollplYV5ojgd0n4jG7/pvYsyEHSnMHTEexAM6R2 k4/Q== 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:cc; bh=XEyySr/AH0rK8wfg6NBkqlU01iaFJRQVLnor9GHGvIk=; b=EVmxl/nCTdbbbUD7GQxr+GFenQ9C1BlPumW61XCXOB7x9+OWQY4wUjcLYfjdw5GTV7 yP9kH1Lb+NBm6zX6Ap8FWZ35GBWM/Ac6ZEERUxGlqQ1TAyvO17wxpNnH+CvG47G07xCR ZH94KvSxl39aiXbpvWUXhjX1laYz9o7eYpNygiX/gqlXXC2IllS73EJnN5mN+L7eE5hr DtYA6EBGBJV5S6jtoXoUgHMNN7W//14vs9ZScm+QAzyhNjcfvDtvgNgwODe+GfTjLdlB vY8ltNRUYyV/8VaZ5rOyH2KyojuIV6NJA90V+hNkjhMGJO+fHqRFiBXE08aYyMIDFv3f XTpg== X-Gm-Message-State: AKaTC017opTHTGpRpB6UigHUaTKvkssO2ayG9gUodMFnQo3P8/Nj9BRUoH2ULWQflVjTcWPHcCBWPq+67ck7RQ== X-Received: by 10.28.199.71 with SMTP id x68mr4881752wmf.34.1479583357975; Sat, 19 Nov 2016 11:22:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.103.10 with HTTP; Sat, 19 Nov 2016 11:22:36 -0800 (PST) Received: by 10.28.103.10 with HTTP; Sat, 19 Nov 2016 11:22:36 -0800 (PST) In-Reply-To: <30925bc7-acb7-e06b-f1bd-aa7b67f07a95@garfieldtech.com> References: <3D1B1C03-6453-4368-8318-29FDB5240845@gmail.com> <30925bc7-acb7-e06b-f1bd-aa7b67f07a95@garfieldtech.com> Date: Sat, 19 Nov 2016 20:22:36 +0100 Message-ID: To: Larry Garfield Cc: PHP Internals List Content-Type: multipart/alternative; boundary=94eb2c0d775877c7de0541ac588d Subject: Re: [PHP-DEV] Immutability RFC From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --94eb2c0d775877c7de0541ac588d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 19.11.2016 19:15 "Larry Garfield" napisa=C5=82(a): > > I'm not Paul, but... > > If you have a data storage system using CRAP (Create Read Archive Purge) instead of CRUD, or EventSourcing, or any other system that needs to maintain history, then you need stored objects that have identities (document abc revision 123, for instance) so you can reference them. In order to maintain history, however, when you load that data into a classed object you do NOT want that object to be mutable, because there is, by design, no way to "update" that object in place in storage. Rather, you'd want to have a special "new object" class that is mutable, persist that to storage, and then on load of historical data you want a read-only object to expose to application code. That object will still have an identity, however. > In Event Sourced application Aggregates and Entities are mutable but pushing Events for later write but speaking of ValueObject which ideally could be immutable classes there is must on immutability and AFAIK there is no need for identity for them. Am I right? > I'm actually working on such a library on the side right now. > > --Larry Garfield > > > On 11/16/2016 11:57 AM, Silvio Mariji=C4=87 wrote: >> >> @Paul, >> I understand that immutable doesn't automatically apply value object. Ca= n >> you give us some examples where immutable object should have identity? >> >> Cheers >> On Nov 16, 2016 4:48 PM, "Paul Jones" wrote: >> >>>> On Nov 16, 2016, at 07:57, Silvio Mariji=C4=87 >>> >>> wrote: >>>> >>>> Hi, >>>> >>>> To anyone who is interested in this RFC. What do you think what behavour >>> >>> we >>>> >>>> should have when you try to compare two immutable objects by identity >>> >>> like >>>> >>>> this: >>> >>> I don't mean to be overly-nitpicky here, but it strikes me that the issue >>> might not be "immutable object" so much as "value object." >>> >>> That is, an immutable object (or at least a read-only object) might ver= y >>> well have an identity. But a *value* object, in addition to read-only or >>> immutable, would have no identity proper. >>> >>> Maybe using the alternative term (if it applies) would help to clarify the >>> situation. >>> >>> >>> -- >>> Paul M. Jones >>> pmjones88@gmail.com >>> 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 > --94eb2c0d775877c7de0541ac588d--