Re: [RFC] Nullable intersection types

From: Date: Fri, 23 Jul 2021 11:05:26 +0000
Subject: Re: [RFC] Nullable intersection types
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-115556@lists.php.net to get a copy of this message
On Fri, Jul 23, 2021 at 11:58 AM Nicolas Grekas <nicolas.grekas@gmail.com> wrote: > Hi everyone, > > as proposed by Nikita and Joe, I'm submitting this late RFC for your > consideration for inclusion in PHP 8.1. Intersection types as currently > accepted are not nullable. This RFC proposes to make them so. > > I wrote everything down about the reasons why here: > https://wiki.php.net/rfc/nullable_intersection_types > > Please have a look and let me know what you think. > > Have a nice read, > > Nicolas > Hi Nicolas, thank you for putting this up. Just two editorial notes: - "This is because any intersection that contains the null type is identical to the null type itself.": I don't think that X&null is the same as null but rather like never (i.e. the "bottom/empty" type, or simply "impossible/nonsensical/bogus")? - "Should brackets around the intersection be: not needed / mandatory / allow both styles": maybe clearer would be e.g. "forbidden / mandatory / optional (allow both styles)"? Regards, -- Guilliam Xavier

« previous php.internals (#115556) next »