Re: [RFC] noreturn type

From: Date: Tue, 30 Mar 2021 17:50:39 +0000
Subject: Re: [RFC] noreturn type
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-113874@lists.php.net to get a copy of this message
Hi Matthew

> I like the proposal. I also support the covariance.
>
> One question though.
> The RFC mentions possible future use of "nothing" as a bottom type for
> parameters in generics. This makes a lot of sense to me. Even without
> generics, it could be used for parameters in abstract methods.
>
> So why not already introduce "nothing" as the universal bottom type, and
> use it instead of "noreturn"?
> Can "noreturn" do anything that "nothing" can't?

I'm also a little confused by this statement. The exact wording from the RFC is:

> Arguments for never: ... It's a full-fledged type, rather than a keyword used in a
> specific situation. A far-in-the-future generics proposal could use never as a placeholder inside
> contravariant generic types.

From what I understand, in Hack noreturn and never are both
full-fledged types. Nothing is a bottom type while noreturn is not.
Since in your proposal noreturn would also be a bottom type there's no
reason why it couldn't be used in covariant or contravariant generic
parameters.

Please correct me if I'm missing something.

Ilija


Thread (37 messages)

« previous php.internals (#113874) next »