Re: PHP header files, restrict to declaring code only
| From: | Robert Hickman | Date: | Wed, 15 May 2019 15:37:22 +0000 |
| Subject: | Re: PHP header files, restrict to declaring code only | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105715@lists.php.net to get a copy of this message | ||
>
> That said... most polyfill files, of which there are a decent number, do some variation on:
>
> <?php
>
> if (!function_exists('coolness')) {
> function coolness(int $coolLevel) { ... }
> }
> ?>
>
I can see quite a lot that could be done with preloading by executing
code once, essentially compile time code execution. For example,
choose which database interface is being used once, instead of every
time the script runs. Or compile 'fluent call chains' into a more
efficient form. If the AST were accessible, there is quite a lot more
that could be done.