Hi! > I'm at a bit of a loss as to why Laruence is claiming that allowing > closures to implicitly access variables in the outer scope requires > duplicating the symbol table.
Because variables need to be stored somewhere after the parent function exits. > Is there any technical reason why it's not possible for scopes to retain a > pointer to their parent scopes so variables can be looked up that way? Because the parent scope will be gone by the time closure is called. Unless we retain a copy of it - which in most cases is very expensive and impractical - you usually don't need all variables from parent scope - you need 1-2 of them, keeping all of them linked to the closure - and thus not freed until closure ceases to exist - would be very expensive. Declaring shared variables explicitly is a trade-off allowing you to not keep all the variables in case you do not need them. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php