8 ms·
I'm quibbling with a quibble, but I don't agree that it's orthogonal to closures. Your example doesn't really demonstrate the eponymous "closing" aspect of the
by Adrock 13y ago
I'm quibbling with a quibble, but I don't agree that it's orthogonal to closures.
Your example doesn't really demonstrate the eponymous "closing" aspect of the closure and doesn't solve the problem that the OP is calling out. Closures are functions that refer to non-local variables. [1] [2] Whether the language provides lexical or dynamic scoping [3] is critical to how and when closures can be used in that language.
[1] http://en.wikipedia.org/wiki/Closure_(computer_science) http://en.wikipedia.org/wiki/Closure_(computer_science)
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...
[3] http://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scoping_and_dynamic_scoping http://en.wikipedia.org/wiki/Scope_(computer_science)#Lexica...