From: Joel VanderWerf Date: 2008-05-18T05:19:33+09:00 Subject: Re: Easy way to use "self" in Proc Leon Bogaert wrote: > I thought I understood the block/proc thing. Guess not... > > I thought when I proc is converted to a block, the code gets evaluated. > So (I thought) when Proc.call() is, euhm, called, the proc gets > converted to a block and is getting evaluated in that context. The block keeps the original context ("lexical scoping"), including local vars, self, and constants: class C class D; end def foo local = 1 proc { [local, self, D] } end end class D; end local = 2 p [local, self, D] p C.new.foo.call -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407