From: Daniel Brockman Date: 2005-08-04T12:46:31+09:00 Subject: Re: Closures Gavin, > I believe that Martin uses the term "closure" incorrectly I agree. This is a pet peeve of mine as well. People seem to think they sound smarter if they always say `closure' instead of simply `function' or (in Ruby's case) `block'. > A function that is a closure has access to the lexical > scoping in which it was defined (the local variables). I'd go further and say that a function that refers to its lexical environment only becomes a closure when that environment is removed from the stack. (Otherwise, why not say that every expression that somehow refers to its environment is a closure?) In other words, if f and g are functions such that g refers to some bindings in the lexical scope of f, then a closure is formed when f returns but a reference to g survives. Intuitively, I think of a closure as a function wrapped up with its environment in a bubble floating off the stack. (Of course, a single function body can be wrapped up into multiple environments, yielding multiple separate closures. Similarily, multiple functions can be wrapped up into the same environment, yielding multiple closures that share a single bubble.) -- Daniel Brockman So really, we all have to ask ourselves: Am I waiting for RMS to do this? --TTN.