From: ara.t.howard@... Date: 2006-08-02T05:18:57+09:00 Subject: Re: I thought this was the one that worked? On Wed, 2 Aug 2006, Chad Perrin wrote: > If that's the case, then *everything else* is a closure too, because > everything else has access to a -- at least where lexical or global scope > exists. 'has access to' and 'keeps a pointer to' are to totally separate things and is, i believe, the crucial difference between what constitues a concrete closure. for instance this_is_a_closure = lambda{} why? read the c code and see that the object indeed contains a pointer to 'this' context that can be referred to in a dynamic (looking up anything that's been added) way. now, this is __not__ a closure because no object exists, specially not the object 'b', which remembers or stores a pointer to the enclosing environment that contains a. the context was not stored and is lost a = 42 b = a + 42 the key thing to remember is that, indeed, any ruby statement has to potential to become an 'enclosing' object since the environment can always be stored with a simple @b = binding nevertheless, not all statements are closures because not all of them choose to remember this environment. blocks however, due to the magic ruby does under the hood and the fact that they must remain valid arguments to eval some_code, a_binding_or_proc do maintain a pointer to the enclosing environment which contains at minimum 'self'. regards. -a -- we can never obtain peace in the outer world until we make peace with ourselves. - h.h. the 14th dali lama