Hey Juliette,

On Wed, 29 Nov 2023 at 03:00, Juliette Reinders Folmer <
php-internals_nos...@adviesenzo.nl> wrote:

>
> For now, I'm just wondering how people feel about these functions.
>

>From my PoV: burn them with fire.
The translation of `compact()` is **trivial** with a CS tool (like the one
you maintain), and the translation of `extract($vars)` is `foreach ($vars
as $k => $v) { $$k = $v; }`, and that's all there is.

Instead, both `compact()` and `extract()` come at additional cognitive load
when reading, scanning, analyzing, debugging and generally understanding
code: a flamethrower helps.

Meanwhile, I'm also wondering if the removal of such functions would help
more in future AOT and JIT improvements: I suppose code using `extract()`
and `compact()` would immediately defeat any JIT, or at least lead to added
code to handle them correctly?

There's a section describing this in HHVM, which is the kind of
problem-space I was thinking of:
https://hhvm.com/blog/713/hhvm-optimization-tips


Marco Pivetta

https://mastodon.social/@ocramius

https://ocramius.github.io/

Reply via email to