News for hackers. Stuff that matters.
Re:How JavaScript closures work under the hood by ScottBurson on Sunday September 06, 2015 @01:37PM (#10178335)
I've noticed that a lot of people (though not the author of this article) confuse the terms "lambda expression" and "closure". Perhaps this confusion is worth taking a moment to address here.

A closure, as explained in the article, is a pair of a code pointer and an environment. It is an object "inside the machine" that exists at runtime.

A lambda expression is a syntactic entity, a piece of source code: something you can see on the screen.

A lambda expression evaluates to a closure, just as an integer literal (a string of digits) evaluates to an integer, or a 'new' expression evaluates to an instance (object).

Re:How JavaScript closures work under the hood by PyComfy on Sunday September 06, 2015 @01:54PM (#10178403)
A closure is a procedure that captures its free variables where those free variables are resolved in the lexical context.

A lambda procedure is just an anonymous procedure.

A lambda is not necessary a closure and a closure is not necessary a lambda.