Hi --

On Tue, 17 Aug 2004, lopex wrote:

> Hi,
> 
> I'm wondering why the following code works:
> 
> class X
> end
> 
> x=X.new
> a="some variable"
> 
> 
> p x.instance_eval("a")
> x.instance_eval{p a}
> 
> why the x object knows the a variable ?

instance_eval sets 'self' to the receiver (x in this case), but it's
still happening in the existing scope, where 'a' is defined.  


David

-- 
David A. Black
dblack / wobblini.net