3 ms·
I don't know, but, often get irriated by the usage of "closures" when it means "anonymous function/expression". > The term closure is often mistakenly used t
by itsnotvalid 15y ago
I don't know, but, often get irriated by the usage of "closures" when it means "anonymous function/expression".
> The term closure is often mistakenly used to mean anonymous function. This is probably because most languages implementing anonymous functions allow them to form closures and programmers are usually introduced to both concepts at the same time. An anonymous function can be seen as a function literal, while a closure is a function value. These are, however, distinct concepts. A closure retains a reference to the environment at the time it was created (for example, to the current value of a local variable in the enclosing scope) while a generic anonymous function need not do this.
- ScottBurson 15y agoAgreed. As I've written here previously: http://news.ycombinator.com/item?id=2303548 http://news.ycombinator.com/item?id=2303548 A longer explanation: http://news.ycombinator.com/item?id=2851446 http://news.ycombinator.com/item?id=2851446
- groovy2shoes 15y agoYou don't have to assume that they actually mean anonymous functions. There's no real reason why the Xtend compiler couldn't translate closures to Java objects.
- itsnotvalid 15y agoBut by closure I usually refer to the definition of some Lisp books: >> a closure is a collection of closed-over variables retained by a function. I don't really dig deep for what the constructs would produce in memory, but they should be some lambda expression.