Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89266 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93789 invoked from network); 17 Nov 2015 12:26:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2015 12:26:56 -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.204 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.204 mail4.serversure.net Linux 2.6 Received: from [217.147.176.204] ([217.147.176.204:51640] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/10-27155-E0D1B465 for ; Tue, 17 Nov 2015 07:26:55 -0500 Received: (qmail 8041 invoked by uid 89); 17 Nov 2015 12:26:51 -0000 Received: by simscan 1.3.1 ppid: 8035, pid: 8038, t: 0.0610s 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; 17 Nov 2015 12:26:51 -0000 To: internals@lists.php.net References: <564A547C.9060504@garfieldtech.com> <564A629C.9040709@rochette.cc> <564A69C1.5080208@garfieldtech.com> <2D.66.34372.2A78A465@pb1.pair.com> <564B09A4.3050706@gmail.com> Message-ID: <564B1D0B.1040003@lsces.co.uk> Date: Tue, 17 Nov 2015 12:26:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <564B09A4.3050706@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Immutable modifier From: lester@lsces.co.uk (Lester Caine) On 17/11/15 11:04, Rowan Collins wrote: > If you look at the PSR-7 implementation I linked to earlier [1], there's > no such boilerplate, just a single call to "clone $this", and PHP does > it all for you. But that doesn't work with a simplistic definition of > immutable like "mutable in constructor" or "mutable until non-null"; you > need to be able to "freeze" an instance once you've set it up, or have > privileged (private) methods which are allowed to mutate the properties. read_only=true; ... after the value is set. Switch off all the 'setter' magic once the object has been created, but I still see a problem where this only really works with simple values? If I've created a more complex object, while it's 'value' may need to be fixed, how it's displayed may involve setting alternative defaults, so one still needs to be able to set other variables in the object. -- 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