From: Eric Armstrong Date: 2006-08-02T06:17:06+09:00 Subject: Re: I thought this was the one that worked? I don't how everyone else will react, but this is the very first explanation I've seen that gives some basis for the linguistic choice of "closure" to describe the concept. Chad Perrin wrote: > On Tue, Aug 01, 2006 at 02:05:17PM +0900, Just Another Victim of the Ambient Morality wrote: > > [ snip ] > >> I _think_ I know what a closure is, as long as Wikipedia and all Ruby >> tutorials haven't conspired to lie to me. Again, it didn't occur to me show >> you that they are closures. I was only trying to show you what will make a >> closure... >> So, are these closures, as you understand them? How is your >> understanding different from mine? > > There was some stuff to digest there, and I'll be digesting it. As for > what I didn't snip, I'll try explaining a closure (as I understand it) > in different terms: > > There is a variable. There is a (something we'll call "lambda"). The > lambda uses the variable. The variable is in a scope outside of the > lambda's scope, but available to the lambda. The variable's original > scope "closes", thus eliminating the variable for purposes of anything > else in the program other than the lambda, thus "closing" the code in > the lambda -- thus the term "closure". It produces circumstances that > object oriented programmers would recognize as "protection" and > "encapsulation". > > How does that mesh with your take on it? >