Re: [RFC][DISCUSSION] - Immutable classes and properties
| From: | Fleshgrinder | Date: | Mon, 12 Dec 2016 18:44:39 +0000 |
| Subject: | Re: [RFC][DISCUSSION] - Immutable classes and properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97375@lists.php.net to get a copy of this message | ||
On 12/11/2016 5:57 PM, Silvio Marijić wrote:
> Hi,
>
> Discussion is open for following rfc þý„üïõ¦–õ
> E™�https://wiki.php.net/rfc/immutability
>
> Cheers
>
-1 from my side for all the things previously mentioned. The
copy-on-write topic must be solved along with the introduction of
immutable classes or we end up with this being implemented and not way
to mutate them in a controlled fashion.
Also -1 on the proposed
copy or modify function. Not only does it
seem to allow anyone to mutate the immutable object, it also requires
magic strings of the property names. No usage search, no refactoring, no ...
I still strongly believe that __clone should be made private or
protected for immutable classes to avoid useless cloning. After that
we either stick to cloning as we currently do in our with* methods or
we provide a keyword that changes the behavior of a method.
I also propose to use data or value instead of immutable as
the
class modifier keyword. Its shorter and properly as well as fully
communicates what kind of object we are building.
--
Richard "Fleshgrinder" Fussenegger