Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53074 invoked from network); 7 Sep 2016 13:19:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2016 13:19:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:47693] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/11-43559-2C310D75 for ; Wed, 07 Sep 2016 09:18:59 -0400 Received: (qmail 30972 invoked by uid 89); 7 Sep 2016 13:18:56 -0000 Received: by simscan 1.3.1 ppid: 30966, pid: 30969, t: 0.0775s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.7?) (lester@rainbowdigitalmedia.org.uk@81.138.11.136) by mail4.serversure.net with ESMTPA; 7 Sep 2016 13:18:56 -0000 To: internals@lists.php.net References: <0e71d28e-1d64-5372-b58d-e54c7afae3b8@fleshgrinder.com> <642a6e78-90ea-cbf0-ec1c-376c24e568c5@fleshgrinder.com> <0800a5ca-3d14-c541-1a1a-2574ec802b8c@fleshgrinder.com> <83fa661e-2d3d-6548-a506-fb969be31c0e@garfieldtech.com> <69D0D60B-3D42-4228-8156-F9E6AFEDF72B@koalephant.com> Message-ID: <5e5733b3-9bd3-0384-bf86-cbda278a8d1f@lsces.co.uk> Date: Wed, 7 Sep 2016 14:18:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC - Immutable classes From: lester@lsces.co.uk (Lester Caine) On 07/09/16 10:28, Silvio Marijić wrote: > DateTimeImmutable does not prevent cloning because immutability is achieved > by encapsulation, and we want to get rid of the need of encapsulation in > our implementation of immutable objects. What is the problem with 'encapsulation'? By that I mean creating readonly result set from class and packaging it with just the links to the functions that display those results. Nothing stopping the class building multiple objects, and the construction code is unnecessary once the target has been created. Simplifying access to the set of variables making up the object might help with all the different options for getters and the like, but essentially the object is just a set of variables which build a result which may potentially just be a pre-formatted string or a number. In my book date/time is still a 32bit day count and 32bit time fraction so a DateTimeImmutable is just a 64bit number ... which you can't write to. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk