On 10/03/2021 18:06, Matthew Brown wrote:
Thanks for the proposal, I can certainly think of uses for it.
I am however slightly confused by what exactly the implementation checks, and when. Is it actually looking for "exit" and "throw" statements?
The text talks about exiting "explicitly or implicitly", but doesn't give any examples of how this works. For instance, is this code valid, and how does PHP know that it's valid?
function my_exit(string $reason): noreturn {
exit("$reason\n");
}
function canned_exit(): noreturn {
my_exit("The normal reason");
}
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.
Regards,
--
Rowan Tommins
[IMSoP]