Re: PATCH: anonymous functions in PHP

From: Date: Mon, 19 Mar 2007 21:17:02 +0000
Subject: Re: PATCH: anonymous functions in PHP
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-28448@lists.php.net to get a copy of this message
I guess I was primarily thinking in the context of the anonymous function being defined in your previous example. As such the parent scope is known (or at least can be expected), unless (unknown to me)
It is known in compile-time. But functions are not called in compile-time. And in run-time, inside usort() - which could in other case be some kind of foo_sort() passing its second parameter to a dozen of other functions, one of which uses it to invoke comparator function - you can not know where the scope in which usort was called is with regard to the scope of the executing anonymous function. And if you took this function name and saved it in the variable - it could be that the scope it was defined in does not exist anymore. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

« previous php.internals (#28448) next »