Either that, or you need to store it in the op_array, which is "bad" because you don't know when you can free that closure state, so you have to carry it around for the rest of the request.
Well, this is a strong argument indeed. However adding new zval type is a big step which adds complexity to the language and tools. We'd also have to modify a bunch of places where callbacks are used to allow this. I think though there's a middle way - if we modify callback type so that instead of array($object, $name) it would accept array($object, $name, $arguments) where arguments are the captured closure variables it might be more convenient. The advantage is that if we don't have closure variables, we don't need to do a thing. We'd need also to deal with decision if we create closure in a class context would it belong to class or global space.
I agree about $_SCOPES['foo']. I'm actually starting to lean towards just copying the entire local scope hash table and storing it in the callable/closure, and using that to initialize the symtable when you call into the function.
That might be not that good an idea. Local table can be very large (and what if it's global scope?), include all kinds of things you won't ever need (such as resources used locally) and the user regards it as transient and doesn't necessarily want to capture it into closure. Even worse, non-closure anon function - i.e. not wanting to use any of the parent context - would then still have the penalty of carrying all the stuff around. I think explicitly declaring might be the best way...
-- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php