hey , i need to list a few pointers :
- first of all , you got confused with lexical scope rules and closures . closures are due to lexical scopes . if there not had been lexical scope , no closures would have been created.
- lexical scope is author time decision . A scope is created at compilation, not at execution . That would have been dynamic scope if that had been the case .
- a closure is a function that remembers it lexical scope if it’s executing outside its scope. you can access variables A,B,G because of lexical scope rules not closures . the function is not even executing outside its lexical scope.
- kyle simpson would have disagreed with this article .