3 ms·
Not much. The other difference is that closures can access the local variables that are in scope at the point where the function is defined. I guess you could h
by alexfarran 17y ago
Not much. The other difference is that closures can access the local variables that are in scope at the point where the function is defined. I guess you could hack this together in C by packing and unpacking the variables into a struct together with the function pointer. It's a bit long winded that way though.
In smalltalk and ruby closures are used extensively to define new control structures using the block syntax.