From: Trans Date: 2005-10-12T15:16:52+09:00 Subject: Re: Default argument values for blocks Eric Mahurin wrote: > I agree. In addition to eval within the block (or even a > method that calls eval), you also have the issue that sometimes > people (including me) have wanted to call eval with > Proc#binding and want access to variables outside the block. I > think the majority of the time that is wanted is when the > binding is from the caller, so those variables won't want to be > GCed yet anyways. One of the solutions I gave was to have all > of the variables not directly referenced in the block be weak > references in Proc#binding, so that GC wouldn't be prevented. > GCing those unused variables would delete the weak references > in Proc#binding. I think this solution would maintain the best > compatibility/flexibility and still solve the problem. This still avoids a solution to closing scope for other uses. For instance Class.new. A = Class.new { class B def x; 1; end end } class B def x; 2; 1 end A::B (irb):19: warning: toplevel constant B referenced by A::B There really needs to be a way to close that off. T.