Movatterモバイル変換


[0]ホーム

URL:


Re: PATCH: anonymous functions in PHP

From:Stanislav MalyshevDate:Wed, 21 Mar 2007 00:24:01 +0000
Subject:Re: PATCH: anonymous functions in PHP
References:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Groups:php.internals 
Request:Send a blank email tointernals+get-28506@lists.php.net to get a copy of this message
$_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.-- Stanislav Malyshev, Zend Products Engineerstas@zend.comhttp://www.zend.com/

Thread (168 messages)

«previousphp.internals (#28506)next »

[8]ページ先頭

©2009-2025 Movatter.jp