>
> I would expect that operating on one of these properties before it's
> initialized will throw an error:
>

Actually, the RFC only says that the "immutability" of properties is
guaranteed after initialization.
We could of course change this premise, but that would make some important
use-cases (like
what Marco's ProxyManager has) impossible to do. Furthermore, unsetting
properties could be
completely disabled by another RFC, given there is a migration path for the
legitimiate use-cases.
As far as I remember, the "Locked Classes" (
https://wiki.php.net/rfc/locked-classes) and lately the
"Rigid Properties" (https://github.com/php/php-src/pull/5170) RFCs try to
have their shots at it.


> Does that work currently or no?  If so, this is pretty sweet.  If not, it
> seems to be of limited use.
>

No, it doesn't work, and it seems to be an unrelated feature for me. As far
as I understand your
example, it's the topic of the "Constant expressions" RFC.

I believe the behaviour proposed by my RFC would be still useful in many
cases where one wants
to be sure that no unexpected modifications can happen with a property. My
use-cases
would mainly include objects storing different kind of data: events, value
objects, data transfer objects.

Máté Kocsis

Reply via email to