News for hackers. Stuff that matters.
Re:Fogus: Node.js should become its own language by raganwald on Tuesday April 12, 2011 @10:12AM (#2437247)
> You can simulate the behavior of lexical scoping by "abusing" closures as someone mentioned before.

I wonder about the word "abusing" here. Languages that have block-level lexical scoping (I hope I am using the correct word) sometimes implement block scoping by renaming the variables and hoisting them to the enclosing function, and they sometimes implement block scoping by creating a new closure just as we do by hand in JavaScript, and then hoisting the result.

For example, naïve implementations of Scheme give you a "let" macro that is expanded into the closure form you give above, and then an optimizing step comes along a little later and performs lambda hoisting for you. So this "abusing" we are doing is what the language would have done for us in certain implementations anyways!

There are no comments on this comment yet.