in reply to Re^10: Accessing lexicals in other scopes dynamically by name
in thread Accessing lexicals in other scopes dynamically by name
Perl functions have pads, but they are re-used, not recreated every call.
In such a scenarion a closure would simply refer to an already existing data-structure containing all variable-bindings - so the number of variables is irrelevant for the cost of creating a closure and >>all<< variable bindings are available to the closure
Again, that would make closures faster at the expense of making every function call slower.
You seem to be implying one can avoid creating some variables, but all you're doing them is creating them sooner and when they're not needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: Accessing lexicals in other scopes dynamically by name
by morgon (Priest) on Jul 31, 2010 at 22:14 UTC | |
by ikegami (Patriarch) on Aug 01, 2010 at 06:34 UTC | |
by morgon (Priest) on Aug 02, 2010 at 00:54 UTC | |
by ikegami (Patriarch) on Aug 02, 2010 at 03:32 UTC |