Re: [RFC] [Discussion] Never parameters

From: Date: Tue, 11 Mar 2025 21:45:46 +0000
Subject: Re: [RFC] [Discussion] Never parameters
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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


Thread (33 messages)

« previous php.internals (#126722) next »