Re: Re: [RFC][Discussion] Har monise "untyped" and "typed" properties
| From: | Rowan Tommins | Date: | Thu, 23 Nov 2023 07:56:07 +0000 |
| Subject: | Re: Re: [RFC][Discussion] Har monise "untyped" and "typed" properties | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121770@lists.php.net to get a copy of this message | ||
On 23 November 2023 01:37:06 GMT, Claude Pache <claude.pache@gmail.com> wrote:
>What you describe in the last sentence is what was initially designed and implemented by the
>RFC: https://wiki.php.net/rfc/typed_properties_v2 (section
>Overloaded Properties).
>
>However, it was later changed to the current semantics (unset() needed in order to trigger
>__get()) in https://github.com/php/php-src/pull/4974
Good find. So not only is it not specified this way in the RFC, it actually made it into a live
release, then someone complained and we rushed out a more complicated version "to avoid
WTF". That's really unfortunate.
I'm not at all convinced by the argument in the linked bug report - whether you get an error or
an unexpected call to __get, the solution is to assign a valid value to the property. And making the
behaviour different after unset() just hides the user's problem, which is that they didn't
expect to *ever* have a call to __get for that property.
But I guess I'm 4 years too late to make that case.
Regards,
--
Rowan Tommins
[IMSoP]