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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php