Hello All,
I would like to start off a debate on the above. We see Closure as something strange and awesome, but indeed it is a simple construct. It's name is taken from family of Set, and it simply means to close over free variables of the inner(return) function. So here we have to create an object of function with reference to all the free variables. This is the best option, and it is the option used by Lua. It is called upvalue in Lua. So how do we do that? You just shift all the variables from the enclosing function's stack to heap (those that also appear inside the enclosed function).
ClosureObj = {refToFreevar, Funparam, FunBody}
That is all you need to effectively add closure to your language. So because we are moving variable objects from stack to heap we have to find a way to avoid copying, that is where pointer (unique identification comes in), we call it reference.
If we think a bit, it would be obvious that having closure in languages with manual memory management will be a bit an issue. You are going to create a lot of objects which may be complex to effectively free them.
However, because C language is pretty much based off pointer , one could have something close to function value via pointer to function. That means you can pass function around and assign it too. But this is not really value function in true sense. It does not know the state of its environment, and will not remember.
The only thing I would want you to take here it that close is a function that is enclosed in one and also remembers its environment. And because of it simple nature and high productivity that comes with it. It is likely to become a must in all major languages.
A hard look at ClosureObj will spin one to start thinking that a little tweaking will lead to continuation. Sure that is true but that is for another day. However, let me state that continuation saves the current stack and program counter (execution pointer) in a simple data structure.