Re: [RFC] Mixed type
| From: | Marco Pivetta | Date: | Fri, 24 Apr 2020 13:58:50 +0000 |
| Subject: | Re: [RFC] Mixed type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109827@lists.php.net to get a copy of this message | ||
Hey Dan,
On Mon, Apr 20, 2020, 13:18 Dan Ackroyd <Danack@basereality.com> wrote:
> Hi Internals,
>
> Here is an RFC for adding a 'mixed' type to the language:
> https://wiki.php.net/rfc/mixed_type_v2
> The RFC builds on an earlier draft by Michael Moravec.
>
> Part of the motivation for pursuing this RFC was my recent experience
> in upgrading an application to PHP 7.4.
>
> Being able to add types to the application made the code much easier
> to reason about, but there were places where I couldn't add type info
> due to the lack of mixed. That made it hard to see if that piece of
> code had been upgraded (but type info couldn't be added), or if that
> code still needed to be upgraded.
>
How much would you like/be adverse to a rector rule that changes
mixed
into a long union type (without resource in it)?
Considering above posts, mixed is effectively
null|bool|string|int|float|array|object, and that the language has the
ability to use this type in 8.0, I think making mixed very painful to
write may be a big advantage.
resource is still a massive PITA: not sure if it can be removed within
the decade.
Heck, we may even deprecate signature-less parameters and return types in a
very far future 💪
>