2020-12-29 15:38 GMT, Larry Garfield <la...@garfieldtech.com>:
> On Tue, Dec 29, 2020, at 2:26 AM, Marc wrote:
>>
>> 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
>
> Two main reasons:
>
> 1) It's not been discussed recently (see how old the dates are on those
> messages), so I wasn't thinking about it.
>
> 2) An immutable class would in all practicality be the same as a class where
> all the properties are initonly (or writeonce, but that was already
> rejected).  So any arguments for/against initonly apply in aggregate to an
> immutable class.
>
> --Larry Garfield
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>

Instead of shoe-horning everything into the PHP object system, did
anyone consider adding support for records instead, which would always
be immutable, and could support the spread operator for cloning-with
similar as in JavaScript or OCaml? They could be based on PHP arrays
and thus be passed by value.

Olle

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to