On Sat, Jan 12, 2008 at 05:28:48PM -0800, Darren New wrote:

C definitely does _not_ have closures.

By virtue of the fact that you can't nest procedure calls, function pointers are closures in C. :-) Everything is either local or global, so as far as I understand the definition of closure, this means a function pointer runs in the same environment in which the pointer was created. :-)

Closures isn't about running in the same environment, it is about capturing
bound variables.  Running in the same environment is more like what you
would find with dynamic scoping.

C only has local or free variables, no bound variables.  Without nested
functions, there aren't any bound variables, so you can't have closures.
Saying you get closures because the language only supports empty closures
is just trying to twist semantics.

Dave

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to