Re: [RFC] [VOTE] Immutable/final/readonly properties
| From: | Dan Ackroyd | Date: | Tue, 17 Mar 2020 17:48:34 +0000 |
| Subject: | Re: [RFC] [VOTE] Immutable/final/readonly properties | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109108@lists.php.net to get a copy of this message | ||
Nicolas Grekas <nicolas.grekas+php@gmail.com> wrote:
(from the other thread)
> there must be a way to work around the keyword -
> either via reflection or another means.
Can you expand on why there 'must' be a way to work around this? Can
you provide some example code where not being able to change the value
is going to cause problems.
> I voted against the RFC because it has too many rough edges to me.
> eg cloning doesn't work, the initialization needs special rules, etc.
To be clear, cloning would work....but just not be useful. But being
required to write a function to copy an object, and overriding the
values doesn't seem like a terrible burden. And, because PHP has an
evolved type system, it is always going to have some 'special rules'
for certain things, just because of maintaining BC.
> I don't think these issues can nor should be figured out later on: they are
> low-level conceptual issues IMHO.
I can't see where the edge-cases are going to bite us. What's an
example of where they can't be figured out later? btw I totally agree
that having them now would be nicer...
cheers
Dan
Ack