Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97063 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72699 invoked from network); 19 Nov 2016 18:15:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2016 18:15:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.29 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.29 out5-smtp.messagingengine.com Received: from [66.111.4.29] ([66.111.4.29:38567] helo=out5-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/02-62522-F9690385 for ; Sat, 19 Nov 2016 13:14:57 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7E5D4206E9 for ; Sat, 19 Nov 2016 13:14:53 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Sat, 19 Nov 2016 13:14:53 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=o6+A/iXUJ021Z61cxe0jwT75Ss4=; b=S4G7LUfxAeWFaSSIBewK TVclU3hXnjqfvTx95YaZcvoQT9p1uBDDkDUqSjhTaw502wJ/dPwG5YRH3sLIcCLA tjZq9fCUuO9K9Fr201xpBkw83M01STlNcTyubqLBUO7brJOvlvjBF2nhPw8jhH/P Rap+nTnfSCCxu7ylD7ocxMg= X-ME-Sender: X-Sasl-enc: wOw8wHJLQpdqq/cAdo1BYG8QDM4TyCR7GFlwvcgLZamv 1479579293 Received: from [10.40.2.10] (unknown [65.205.30.226]) by mail.messagingengine.com (Postfix) with ESMTPA id 4491E7E9B5 for ; Sat, 19 Nov 2016 13:14:53 -0500 (EST) To: internals@lists.php.net References: <3D1B1C03-6453-4368-8318-29FDB5240845@gmail.com> Message-ID: <30925bc7-acb7-e06b-f1bd-aa7b67f07a95@garfieldtech.com> Date: Sat, 19 Nov 2016 13:14:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Immutability RFC From: larry@garfieldtech.com (Larry Garfield) 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. I'm actually working on such a library on the side right now. --Larry Garfield On 11/16/2016 11:57 AM, Silvio Marijić wrote: > @Paul, > I understand that immutable doesn't automatically apply value object. Can > 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ć >> 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 very >> 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 >> >> >> >>