Hi Internals,
With recent additions of the type system like union types [1], id like to propose adding intersection types as well.
Looking through past RFCs I found one from 2016 [2] which never left the discussion phase and is currently marked as inactive.
Before continuing with an RFC I'd like to know if there are any particular reasons why the original RFC never got into a voting phase, so that this one may be more successful.
P.S. I’d also like to get RFC karma so I could create a proposal.
Thanks in advance!
[1] https://wiki.php.net/rfc/union_types_v2 https://wiki.php.net/rfc/union_types_v2
[2] https://wiki.php.net/rfc/intersection_types <https://wiki.php.net/rfc/intersection_types
Hi Internals,
With recent additions of the type system like union types [1], id like
to propose adding intersection types as well.Looking through past RFCs I found one from 2016 [2] which never left
the discussion phase and is currently marked as inactive.
Before continuing with an RFC I'd like to know if there are any
particular reasons why the original RFC never got into a voting phase,
so that this one may be more successful.P.S. I’d also like to get RFC karma so I could create a proposal.
Thanks in advance!
[1] https://wiki.php.net/rfc/union_types_v2
https://wiki.php.net/rfc/union_types_v2
[2] https://wiki.php.net/rfc/intersection_types
https://wiki.php.net/rfc/intersection_types
To my recollection, the original RFC was met with a general "meh, sounds complicated, and why would you want to do that?" which is why it never went as far as a vote. I don't know if there was an implementation. Note that it was proposed seemingly in conjunction with union types v1, and a lot of the discussion really confused the two.
4 years later, Nikita tried union types a second time and they sailed through. I couldn't say why, but I speculate that it was a combination of 4 years of the community maturing, different people being around, and just union types without intersection types being an easier thing to swallow.
I'd say go for it. I'd love to see intersection types, as it would be very helpful to certain use cases with FIG PSRs. (Eg, "I want an object that is a Response and also has the Link extensions from PSR-13 on it" is currently impossible to specify. Intersection types would solve that perfectly.)
--Larry Garfield
Hi Internals,
With recent additions of the type system like union types [1], id like
to propose adding intersection types as well.Looking through past RFCs I found one from 2016 [2] which never left
the discussion phase and is currently marked as inactive.
Before continuing with an RFC I'd like to know if there are any
particular reasons why the original RFC never got into a voting phase,
so that this one may be more successful.P.S. I’d also like to get RFC karma so I could create a proposal.
Thanks in advance!
[1] https://wiki.php.net/rfc/union_types_v2
https://wiki.php.net/rfc/union_types_v2
[2] https://wiki.php.net/rfc/intersection_types
https://wiki.php.net/rfc/intersection_typesTo my recollection, the original RFC was met with a general "meh, sounds
complicated, and why would you want to do that?" which is why it never went
as far as a vote. I don't know if there was an implementation. Note that
it was proposed seemingly in conjunction with union types v1, and a lot of
the discussion really confused the two.4 years later, Nikita tried union types a second time and they sailed
through. I couldn't say why, but I speculate that it was a combination of
4 years of the community maturing, different people being around, and just
union types without intersection types being an easier thing to swallow.I'd say go for it. I'd love to see intersection types, as it would be
very helpful to certain use cases with FIG PSRs. (Eg, "I want an object
that is a Response and also has the Link extensions from PSR-13 on it" is
currently impossible to specify. Intersection types would solve that
perfectly.)--Larry Garfield
--
I second everything that Larry said.