On Dec 12, 2005, at 11:07 AM, ako... wrote:

> thank you. if lambda creates an object during its execution, and by  
> the
> time lambda finishes the object goes out of scope, is the object
> garbage collected?

The object is eligible for garbage collection.  It may or may not be  
collected immediately.

def inner
   obj = Object.new # <-- object created
   return lambda {} # <-- object held by lambda, not eligible for GC
end

def outer
   my_proc = inner # <-- object still held by lambda, not eligible  
for GC
   return nil
end

outer # <-- proc eligible for GC, so created object eligible for GC

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com