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

2021-07-29 Thread Brent Roose
Hi internals I wanted to apologise for the poor wording I used in my previous mail when I said "oversight". What I meant to say is what Nicolas described in his followup mail: feature freeze as a time to polish implementations. I personally consider nullability to be more of an implementation

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

2021-07-28 Thread Deleu
On Wed, Jul 28, 2021, 05:26 Pierre Joye wrote: > However my question was more about the rush for it, those are not easy to > implement nicely, given the actual use cases, I am not sure it was worth > this hurry. And I have the same feeling for this discussion about nullable > intersection. > My

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

2021-07-27 Thread Pierre Joye
Hi Jordan, On Wed, Jul 28, 2021, 10:02 AM Jordan LeDoux wrote: > Intersection types are very useful if you use composition over > inheritance. That is, in PHP, they are most useful when you are using > multiple interfaces and/or traits to represent different aspects of an > object which might

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

2021-07-27 Thread Jordan LeDoux
Intersection types are very useful if you use composition over inheritance. That is, in PHP, they are most useful when you are using multiple interfaces and/or traits to represent different aspects of an object which might be present. For example, using an actual library I maintain, I have a

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

2021-07-27 Thread Pierre Joye
Good morning, On Wed, Jul 28, 2021 at 5:52 AM Rowan Tommins wrote: > > On 27 July 2021 21:29:47 BST, "André Hänsel" wrote: > >> In fact, when 7.1 was released, none of the signatures changed in my > >code, they were just > >> updated to a different syntax. > > > >That by the way is only because

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

2021-07-27 Thread Rowan Tommins
On 27 July 2021 21:29:47 BST, "André Hänsel" wrote: >> In fact, when 7.1 was released, none of the signatures changed in my >code, they were just >> updated to a different syntax. > >That by the way is only because of a specific compatibility behavior >which is so confusing >that I erroneously

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

2021-07-27 Thread André Hänsel
> In fact, when 7.1 was released, none of the signatures changed in my code, > they were just > updated to a different syntax. That by the way is only because of a specific compatibility behavior which is so confusing that I erroneously reported it as a bug:

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

2021-07-27 Thread Jordan LeDoux
> - PHP 7.0 types were a pain because of non-nullable types, the feature only became really useful as of PHP 7.1 See, this keeps being said, but as another userland developer it's extremely confusing. The types in 7.0 were very useful, and I personally didn't notice at all that they were missing

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

2021-07-27 Thread Brent Roose
Hi all From a userland developer point of view: - PHP 7.0 types were a pain because of non-nullable types, the feature only became really useful as of PHP 7.1 - I share many people's opinion that this falls in the category of oversight - I think (A)|null is the only sensible way to go

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

2021-07-27 Thread Rowan Tommins
On 27/07/2021 14:32, Brent Roose wrote: From a userland developer point of view: - PHP 7.0 types were a pain because of non-nullable types, the feature only became really useful as of PHP 7.1 You're not the only person to say this, but I find it really hard to believe. If this was so

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

2021-07-27 Thread Andreas Leathley
On 23.07.21 11:58, 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 everything down about the

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

2021-07-26 Thread Sara Golemon
On Fri, Jul 23, 2021 at 4:58 AM Nicolas Grekas wrote: > https://wiki.php.net/rfc/nullable_intersection_types > > I've commented on the PR and in R11 a bit already, but I'd like to state my position here for the record. I do see the value in having nullability, but I can't disagree enough with

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

2021-07-24 Thread Larry Garfield
On Sat, Jul 24, 2021, at 12:33 AM, Tobias Nyholm wrote: > >> @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

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

2021-07-24 Thread Alexandru Pătrănescu
On Fri, Jul 23, 2021, 11:58 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-24 Thread Levi Morrison via internals
> That is a strange attitude. You are saying that you rather see a release with > a [known] flaw than actually trying to find the best solution. Sorry, but sometimes features take time either due to technical reasons (variance was difficult to get right this way), or due to disagreements in

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

2021-07-24 Thread Joe Watkins
This is not a new feature. This is a detail of a feature that was not well understood for whatever reason. That is why we are willing to fix it after freeze. I would ask anyone voting to vote on the basis of the detail and leave timing to be the problem of release managers. Voting negatively

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

2021-07-24 Thread Mike Schinkel
> On Jul 24, 2021, at 1:33 AM, Tobias Nyholm wrote: >> If you are not willing to compromise you will probably get nothing. >> >> It is relevant because I was trying to get you to ask yourself if you would >> be happier if you get half of what you want rather than none of what you >> want. >>

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

2021-07-24 Thread Deleu
On Sat, Jul 24, 2021, 07:33 Tobias Nyholm wrote: > > >>> Given both of these sets of assertions I would ask the RFC's author > and proponents what would be a worse outcome? > >> > >> I don’t see how this question is relevant. We are not seeking > compromises at the moment. We are seeking the

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

2021-07-24 Thread Jordan LeDoux
I do not think this is strictly true. The issue that this RFC is running into is that combination types between intersections and unions was something that was avoided for the intersection types RFC. Not because the authors never thought of it, but because the RFC would have become very broad and

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] [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

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 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] [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 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 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 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 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 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 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 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 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 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