Hi Rowan,

On Wed, Mar 10, 2021, 20:55 Rowan Tommins <rowan.coll...@gmail.com> wrote:

> On 10/03/2021 18:06, Matthew Brown wrote:
> > Ondřej Mirtes and I present an RFC for the noreturn type:
> > https://wiki.php.net/rfc/noreturn_type
>
>
> Thanks for the proposal, I can certainly think of uses for it.



> The other thing I'd like to mention is that PHP's implementation of
> "void" consists mostly of checking that there is no return statement, so
> a separate keyword of "noreturn" may well cause confusion. I would
> personally prefer the name "never" for this reason.
>

I would mostly say that "void" consists of checking that no value is
returned as plain `return;` statements are fine.
While actually "noreturn" consists of checking that there is no return
statement, implicit or explicit.

As another distinction I noticed, for "void" the validation can be done
completely at compile time but for "noreturn" both compile and run time are
necessary right now.
Hopefully, static analysis tools like psalm can further understand better
and better the runtime execution paths and provide with errors.

I was just reading the github committed RFC earlier this morning and I
liked it.

Regards,
Alex

Reply via email to