On Tuesday, 11 March 2025 at 21:45, Larry Garfield <la...@garfieldtech.com> wrote:
> On Mon, Mar 10, 2025, at 2:05 PM, Daniel Scherzer wrote: > > > Hi internals, > > > > I'd like to start discussion on a new RFC about allowing `never` for > > parameter types when declaring a method. > > > > * RFC: https://wiki.php.net/rfc/never-parameters-v2 > > * Implementation: https://github.com/php/php-src/pull/18016 > > > > -Daniel > > > I have a use case for this in Serde, so would be in favor. > > We should not block this kind of improvement on the hope of generics. Worst > case, we have this plus generics so you have options, how terrible. > > Rust-style associated types would probably work as well. I'd be fine with > that approach, too. One could argue they're more valuable as a sort of > "junior generics," but absent anyone able and willing to implement them, > again, worst-case we end up with options in the future. > > --Larry Garfield As the person that had the initial discussion in R11 with Jordan [1] never as a parameter type for an interface actually is not the solution for "poor man generics". Matthew Fonda [2] already replied to the thread pointing out the remark Nikita made in the discussion of the previous RFC. But importantly, going from mixed parameter type to a generic parameter type is *allowed* and not a BC change, however, going from a never parameter type to a generic parameter type is a BC break. Thus, I am not sure this really a good idea. The argument from Alwin is more compelling but considering we don't have conditional types, not sure if this makes sense either. Best regards, Gina P. Banyard [1] https://chat.stackoverflow.com/transcript/11?m=52810456#52810456 [2] https://externals.io/message/126698#126791