On Mon, 2007-03-19 at 14:17 -0700, Stanislav Malyshev wrote:
> > 
> > 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.

I'm not arguing the preservation of the exact value of $rev when the
anonymous function was created (as would be the case with a closure).
I'm thinking of the variable being whatever is defined in the parent
regardless. As in my proposal, the seek could search all the way up to
the top in which case the $rev would be found if it had been defined as
expected. At any rate, I guess this is diverging from the real
discussion of anonymous functions :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to