Re: [VOTE] Nullable intersection types
| From: | Alexandru Pătrănescu | Date: | Sun, 15 Aug 2021 04:26:32 +0000 |
| Subject: | Re: [VOTE] Nullable intersection types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115733@lists.php.net to get a copy of this message | ||
On Sun, Aug 15, 2021, 04:33 Marco Pivetta <ocramius@gmail.com> wrote:
> Heyo, just a follow-up.
>
> On Fri, 13 Aug 2021, 13:30 Marco Pivetta, <ocramius@gmail.com> wrote:
>
> > Hey Nicolas,
> >
> > I voted NO on this one. I'm not opposed to nullable intersection types,
> > but not in PHP 8.1.
> >
> > Specifically, I'm waiting for the first RC releases to land in September
> > to even start looking at PHP 8.1 support for any of my projects, and
> > stability is key.
> >
> > I also am not on board with the lack of design around reflection API
> here.
> >
>
> I just re-checked the RFC, and I'm completely against the reflection design
> in here (which I previously dismissed as "oversight").
>
> An
(A&B)|null is **not** a
> ReflectionIntersectionType, but should
> instead be a ReflectionUnionType.
>
>
> Therefore, adding this to the "NO" reasons, since we'll otherwise have to
> live with this mistake for many years to come.
>
>
Just to mention here, A|null is also not a ReflectionUnionType but a
ReflectionNamedType,
union with null already being a special case.
https://3v4l.org/lM9NJ
But the fact that these things might not be known clearly and the fact that
nullability concept wasn't discussed and agreed on for the type system in
general, I also think the feature can wait for 8.2.
Alex