Re: [VOTE] Make compact function reports undefined passed variables

From: Date: Wed, 13 Jun 2018 08:42:16 +0000
Subject: Re: [VOTE] Make compact function reports undefined passed variables
Groups: php.internals 
Request: Send a blank email to internals+get-102243@lists.php.net to get a copy of this message
On Jun 10, 2018 10:46 PM, "Hoffman, Zachary Robert" <zrhoffman@ku.edu> wrote: >The existence of anything that internally relies on > ö�yµ¸ 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. Accessing variables by name is a problem for optimimisation and JIT-ing, because we lose data-flow dependencies. But, this is not the end of the world. We just don't optimize functions that use this "bad" pattern. Thanks. Dmitry. 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.

« previous php.internals (#102243) next »