>The existence of anything that internally relies on `get_defined_vars()` is a
>blocker for applying further optimisations to the engine (think stack frames),
>which is probably why Dmitry suggested its removal.
I did not know it was an optimization issue. I suppose I could substitute a
userland equivalent:
function compact_(array $compact, array $vars)
{
return array_intersect_key($vars, array_flip($compact));
}
which changes A::c() to
function c()
{
$d = $this->d();
$a = pow($d, $d + 1);
$c = $a ^ 0b1100;
$b = $a - $d;
return new B(
compact_(
$this->b(),
get_defined_vars()
)
);
}
That is not so bad. As far as I am concerned, deprecate away.