[PHP-DEV] Re: [RFC] Nullable intersection types

2021-07-23 Thread Mark Randall
On 23/07/2021 10:58, Nicolas Grekas wrote: Hi everyone, I wrote everything down about the reasons why here: https://wiki.php.net/rfc/nullable_intersection_types IMO we should require brackets and forbid not using them when combining unions and intersections. These types are already going

[PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Nicolas Grekas
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:

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Guilliam Xavier
On Fri, Jul 23, 2021 at 11:58 AM Nicolas Grekas 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

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Levi Morrison via internals
> As you note in the RFC, PHP already defines `|` as having a lower > precedence than `&`, so `X & Y | null` can only be interpreted as > `(X & Y) | null`. This is consistent with other languages such as > TypeScript, where `A & B | C & D` is parsed as `(A & B) | (C & D)`. > [2] > > Since

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Benjamin Eberlei
On Fri, Jul 23, 2021 at 4:31 PM Deleu wrote: > On Fri, Jul 23, 2021 at 2:36 PM Derick Rethans wrote: > > > From the RFC: «Taking all these elements into account, the preference > > of... and thus to use the "?X" syntax». > > > > I think this would be a mistake. You touch upon operator

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Theodore Brown
On Friday, July 23, 2021 at 4:58 AM Nicolas Grekas 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

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Pierre
Le 23/07/2021 à 17:56, Levi Morrison via internals a écrit : As you note in the RFC, PHP already defines `|` as having a lower precedence than `&`, so `X & Y | null` can only be interpreted as `(X & Y) | null`. This is consistent with other languages such as TypeScript, where `A & B | C & D` is

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Derick Rethans
On Fri, 23 Jul 2021, Nicolas Grekas wrote: > 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

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Deleu
On Fri, Jul 23, 2021 at 2:36 PM Derick Rethans wrote: > From the RFC: «Taking all these elements into account, the preference > of... and thus to use the "?X" syntax». > > I think this would be a mistake. You touch upon operator precedence, and > needing to know whether | or & is higher, and

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Larry Garfield
On Fri, Jul 23, 2021, at 11:06 AM, Pierre wrote: > Le 23/07/2021 à 17:56, Levi Morrison via internals a écrit : > >> As you note in the RFC, PHP already defines `|` as having a lower > >> precedence than `&`, so `X & Y | null` can only be interpreted as > >> `(X & Y) | null`. This is consistent

Re: [PHP-DEV] Re: [RFC] Nullable intersection types

2021-07-23 Thread Benjamin Eberlei
On Fri, Jul 23, 2021 at 12:55 PM Mark Randall wrote: > On 23/07/2021 10:58, Nicolas Grekas wrote: > > Hi everyone, > > I wrote everything down about the reasons why here: > > https://wiki.php.net/rfc/nullable_intersection_types > > > IMO we should require brackets and forbid not using them when

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Nicolas Grekas
> > 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: > >

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Nicolas Grekas
Le ven. 23 juil. 2021 à 13:05, Guilliam Xavier a écrit : > > On Fri, Jul 23, 2021 at 11:58 AM Nicolas Grekas > 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 >>

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Levi Morrison via internals
On Fri, Jul 23, 2021 at 6:37 AM Derick Rethans wrote: > > From the RFC: «Taking all these elements into account, the preference > of... and thus to use the "?X" syntax». > > I think this would be a mistake. You touch upon operator precedence, and > needing to know whether | or & is higher, and

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Pierre
Le 23/07/2021 à 18:25, Larry Garfield a écrit : Requiring parenthesis now leaves the option open in the future to make them optional when doing full mixed types. Making them optional now requires that they be optional in the future when doing full mixed types. I vaguely recall there being

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Tobias Nyholm
>> @Larry makes an argument to keep them: >> >>> Requiring parenthesis now leaves the option open in the future to make them >>> optional when doing full mixed types. >> >> >> I don’t understand why we should require something that is not needed simply >> because it would give us an option

Re: [PHP-DEV] Problems with the mailing list [was: Re: [PHP-DEV] Request for karma to vote on RFCs]

2021-07-23 Thread Mike Schinkel
> On Jul 20, 2021, at 3:44 AM, Lynn wrote: > > On Tue, Jul 20, 2021 at 9:33 AM Peter Bowyer > wrote: > >> I have now been contacted by 2 people who tried multiple times to join this >> mailing list and cannot. >> >> It took me 5 weeks for my signup to work. During that time I emailed the >>

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Mike Schinkel
> On Jul 24, 2021, at 12:42 AM, Tobias Nyholm wrote: > >> It seems this RFC is actually trying to accomplish two(2) things: >> >> 1. Add typehints for nullable intersection types to PHP. >> 2. Get PHP to support a preferred syntax for type-hinting nullable >> intersection types. > > Yes of

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Tobias Nyholm
> It seems this RFC is actually trying to accomplish two(2) things: > > 1. Add typehints for nullable intersection types to PHP. > 2. Get PHP to support a preferred syntax for type-hinting nullable > intersection types. Yes of course. You cannot really do #1 without #2. I agree with Nicolas

Re: [PHP-DEV] [RFC] Nullable intersection types

2021-07-23 Thread Mike Schinkel
> On Jul 23, 2021, at 5:58 AM, Nicolas Grekas 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