in reply to Re^6: Unable to declare local variable with "use strict".
in thread Unable to declare local variable with "use strict".
[ Please ignore this post and read Re^7: Unable to declare local variable with "use strict". instead ]
Are you saying he shouldn't call it a closure because (you say) it's not the general or typical example?
The code featured functions that captures a variable beyond it's normal scope. They are very much closures.
It's really not that atypical either. It happens whenever you have module-level lexicals. The lexicals would normally fall out of scope when the module finished executing when it's loaded, but they survive thanks to the methods that capture them.
The only difference between named and unnamed subs is when the capture occurs. Named subs are instantiated at compile-time, so they capture at compile-time. Unnamed subs are instantiated at run-time, so they capture at run-time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Unable to declare local variable with "use strict".
by JavaFan (Canon) on Mar 29, 2010 at 16:58 UTC | |
by ikegami (Patriarch) on Mar 29, 2010 at 17:04 UTC |