Re: Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties
| From: | Claude Pache | Date: | Thu, 23 Nov 2023 01:37:06 +0000 |
| Subject: | Re: Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121766@lists.php.net to get a copy of this message | ||
> Le 22 nov. 2023 à 23:17, Rowan Tommins <rowan.collins@gmail.com> a écrit :
>
> I'm probably going to regret asking this, but is there some reason it works that way? Is
> there any chance of changing it to just:
>
>> Typed properties start off as uninitialized.
>>
>> Once you've assigned a value, you can't go back to the original uninitialized
>> state using unset()
>>
>> Accessing an uninitialized property will first check for __get, and throw an error if that
>> isn't defined.
Hi Rowan,
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
—Claude