Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties
| From: | Claude Pache | Date: | Fri, 17 Nov 2023 15:02:29 +0000 |
| Subject: | Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121707@lists.php.net to get a copy of this message | ||
> Le 17 nov. 2023 à 14:53, Rowan Tommins <rowan.collins@gmail.com> a écrit :
>
> On 17 November 2023 13:30:42 GMT, Claude Pache <claude.pache@gmail.com> wrote:
>>
>> Yes, except that an untyped (respectively
mixed) property
>> cannot be redeclared as mixed (resp. untyped) in a subclass. A small
>> step in the right direction is to allow that.
>
> Huh, I didn't know that. I'll add it to the RFC, at least to consider.
>
> The RFC to add "mixed" gives an example of removing the type as invariance, but
> doesn't seem to justify why "untyped" and "mixed" should be considered
> different, from a type system point of view.
> https://wiki.php.net/rfc/mixed_type_v2
Note that untyped is different from mixed in the case of return values of functions: in
that context, untyped is equivalent to mixed|void. In all other contexts, untyped and
mixed are effectively equivalent, because void is void of sense.
—Claude