Re: RFC: Locked Classes
| From: | Rowan Collins | Date: | Sun, 10 Mar 2019 19:23:00 +0000 |
| Subject: | Re: RFC: Locked Classes | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104624@lists.php.net to get a copy of this message | ||
Hi Marco,
On 10/03/2019 18:51, Marco Pivetta wrote:
Overall good idea, except that I disagree with the unset() being disabled: that bit is strictly required for lazy-loading purposes, and mostly harmless for userland ("normal" people don't do it, libraries do it).
To me, the unset() restriction fits naturally into the definition; I think most people would consider "removing a property" in the same category as "adding a property". Notably, it's included in ECMAScript's definition of sealed objects [1], which is essentially the same feature.
I understand that unset() currently enables a neat trick for lazy-loading, but it feels like just that to me: a trick, not a core part of the language. Similarly, there may be tricks that rely on adding dynamic properties to objects, but that's fine, just don't mark those classes as "locked".
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal
Regards,
--
Rowan Collins
[IMSoP]