Stanislav Malyshev wrote:
$_SCOPE doesn't need to be that special... It can just be an object
with overloaded array access... Whenever a dim is fetched for that
object, check current_execute_data->prev->symbol_table for the
variable and return that.
Once again - current_execute_data->prev at *closure runtime* has nothing
common with the symbol table that closure is supposed to capture. The
symbol table is present at the *closure instantiation* time - i.e. when
$foo = function(...) {...} (1)
is executed, not when
$foo(...) (2)
is executed. (1) may be executed in scope entirely unrelated to (2) and
only in rare special cases scope (1) would precede scope (2). In many
other cases, totally unrelated scope would be predecessor of (2) and
getting values from there would be a big surprise to the user.
Ah, I understand now. This isn't something which should be evaluated
when the function is run, but rather when it's bound.
No sir, I don't like it. -1 from me.
-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php