Re: [RFC] [VOTE] Transform exit() from a language construct into a standard function
| From: | Christoph M. Becker | Date: | Tue, 30 Jul 2024 11:47:55 +0000 |
| Subject: | Re: [RFC] [VOTE] Transform exit() from a language construct into a standard function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124684@lists.php.net to get a copy of this message | ||
Hi Gina!
On 30.07.2024 at 11:49, Gina P. Banyard wrote:
> I have just opened the vote for the "Transform exit() from a language construct into a
> standard function" RFC:
> https://wiki.php.net/rfc/exit-as-function
>
> The vote will last for two weeks until the 13th of August 2024.
As userland PHP developer, I always regarded
exit as a control flow
instruction (quite similar to break), and as such I'm not really in
favor of converting it to a proper function (especially since it is not,
because the parantheses could be omitted).
Would that RFC imply that I would need to write \exit or have a `use
exit` clause to avoid dynamic namespace lookup? If so, I would be even
less in favor of that change.
I do understand your point about the type juggling semantics, but I
might have addressed that differently. I almost always use exit
without argument (and if, only with an int), and die always with a
string (and only for quick experiments), and I figure that this might be
what most contemporary code does (at least, I hope that the
do_something() or die() times have long gone). As such, having exit
and die as alias could be changed, sticking with exit as a control
flow instruction, and having die as proper function (which could even
be implemented in userland), where exit would allow an optional int
argument (like break), and die() a required string argument. Of
course, this would be a much bigger BC break, but it seems to me the
cleaner solution.
Cheers,
Christoph