Hacker News new | ask | show | jobs
by itsnotvalid 5347 days 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.
2 comments

Agreed. As I've written here previously:

http://news.ycombinator.com/item?id=2303548

A longer explanation:

http://news.ycombinator.com/item?id=2851446

You 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.
But 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.