Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97101 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16526 invoked from network); 21 Nov 2016 09:20:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2016 09:20:28 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 185.153.204.204 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 185.153.204.204 mail4.serversure.net Linux 2.6 Received: from [185.153.204.204] ([185.153.204.204:58930] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/36-65233-85CB2385 for ; Mon, 21 Nov 2016 04:20:26 -0500 Received: (qmail 15606 invoked by uid 89); 21 Nov 2016 09:20:21 -0000 Received: by simscan 1.3.1 ppid: 15600, pid: 15603, t: 0.5775s 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; 21 Nov 2016 09:20:21 -0000 To: internals@lists.php.net References: <30416a57-2cb5-d192-9b3d-1546a11d9661@rochette.cc> Message-ID: Date: Mon, 21 Nov 2016 09:20:20 +0000 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: <30416a57-2cb5-d192-9b3d-1546a11d9661@rochette.cc> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Immutability RFC From: lester@lsces.co.uk (Lester Caine) On 21/11/16 08:46, Mathieu Rochette wrote: >> The term 'immutable", especially for the property-annotation, doesn't >> strictly seem correct to me either, as for example, I can annotate a >> public >> property as immutable, but if I put an object in there, that object is >> not >> necessarily immutable. The correct term for this feature, especially for >> properties, I would think is "readonly" - which would be consistent with >> the description of certain existing properties in PHP APIs, such as >> PDOStatement::$queryString, as well as with other languages such as C#. > I'm not sure about that one because I can't find it explicitly in the > rfc (maybe it need to be added ?) but I think immutable properties only > accept immutable scalar or objects. otherwise you're right, it would not > be immutable The RFC is yet another attempt to add rules to areas of PHP without getting back to the very basic ... variables are the base element that in an ideal world would have a full set of properties. type, range/enum, size, read-only and the like. A sub set of properties on an object may need to be read-only and if that includes the values returned by the methods of the object then the object itself becomes read-only. Current options for doing this include things like 'getters' and 'setters' and other standards applied in user land including PHP-FIG, but there still seems not incentive to address the basic building block and make it work the same way for everybody whether simply validating raw data, or protecting fields that have rules preventing updating. -- 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