On Wed, 2 Aug 2006, Chad Perrin wrote:

> We're back to the absurdly broad here:
>
> If any "thing" that has access to another scope is a closure, that makes
> every nested "thing" in a language with global and/or lexical scope a
> "closure".  That's a little like defining a "human" as "has four limbs".

closures in ruby have neither global nor lexical scope though:


   harp:~ > cat a.rb
   class Object
     def closure(&b) b end
   end

   c = closure

   def a() p 42 end
   eval 'a', c

   def a() p 'forty-two' end
   eval 'a', c



   harp:~ > ruby a.rb
   42
   "forty-two"


the scoping is dynamic.  in otherwords we can add things to the enclosed state
later - it's not frozen at the time the closure is created.

that can refine the def a bit.

regards.

-a
-- 
we can never obtain peace in the outer world until we make peace with
ourselves.
- h.h. the 14th dali lama