Re: Analysis of property visibility, immutability, and cloning proposals
| From: | Olle Härstedt | Date: | Tue, 29 Dec 2020 10:28:41 +0000 |
| Subject: | Re: Analysis of property visibility, immutability, and cloning proposals | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112633@lists.php.net to get a copy of this message | ||
2020-12-29 8:26 GMT, Marc <marc@mabe.berlin>:
>
> On 28.12.20 21:23, Larry Garfield wrote:
>> There's been a number of discussions of late around property visibility
>> and how to make objects more immutable. Since it seems to have been
>> well-received in the past, I decided to do a complete analysis and context
>> of the various things that have been floated about recently.
>>
>> The full writeup is here:
>>
>>
>> https://peakd.com/hive-168588/@crell/object-properties-and-immutability
>>
>> I hope it proves stimulating, at least of discussion and not naps.
>>
>
> Thanks for the nice write up Larry!
>
> Is there a reason you didn't mention the proposal for immutable classes?
> (probably because it never went into a final RFC)
>
> https://externals.io/message/94913#94913
>
> https://externals.io/message/79180#79180
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
I just want to mention that immutability might be applied too
liberally in the current discourse, and in some cases, what you really
want is *non-aliasing*, that is, uniqueness, to solve problems related
to immutability. I think methods like
withX is an anti-pattern, in
fact, and a symptom that you do not *really* want immutability, but
rather uniqueness, at least in some cases.
Olle