Re: [RFC] Transform exit() from a language construct into a standard function
| From: | Gina P. Banyard | Date: | Sun, 26 May 2024 21:42:55 +0000 |
| Subject: | Re: [RFC] Transform exit() from a language construct into a standard function | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123430@lists.php.net to get a copy of this message | ||
On Tuesday, 14 May 2024 at 17:24, Juliette Reinders Folmer
<php-internals_nospam@adviesenzo.nl> wrote:
> On 11-5-2024 16:43, Gina P. Banyard wrote:
>
>> On Thursday, 9 May 2024 at 15:17, Jorg Sowa
>> [<jorg.sowa@gmail.com>](mailto:jorg.sowa@gmail.com) wrote:
>>
>>>> I don't think there are any other "functions" like this.
>>> What about list(), isset(), print(), echo(), require(), include(), unset(), empty()? We
>>> use them the same way as functions, but those are not real functions.
>>
>> list() (and array()) may look like functions but do not behave like one as they affect the
>> current scope by setting various variables.
>>
>> isset()/empty()/unset() require to work with undefined variables and have deeply ingrained
>> behaviour within the engine, so making them simple functions is not as much of a "trivial"
>> change.
>>
>> print, echo, include(_once) and require(_once) do not mandate their "argument" to
>> be passed within parenthethis, so making them functions does not simplify the lexer/parser nor
>> removes them as keywords.
>> Also I don't know the last time I've used those language constructs "like a
>> function".
>
> Seeing this list, makes me wonder: what about eval() ?
eval() might make sense to try and convert to a function, this would probably also cleany solve the
complaint about not being able to disable eval() [1][2]
Best regards,
Gina P. Banyard
[1] https://bugs.php.net/bug.php?id=62397
[2] https://github.com/php/php-src/pull/4084