On Monday 24 November 2003 06:40 pm, Sean E Russell wrote:
> But... this doesn't work in Ruby anyway.  'a' isn't in scope inside the
> method.  Cut, paste, and run:
>
> 	a = [1,2,3]
> 	def z
> 		p a
> 	end
> 	z
>
> Why should method definitions in evals behave any differently?

"Wait a minute."  Why isn't  a  available in the scope of this method 
definition? What's the reasoning behind preventing that? Ruby does
assign a, so its there. What scope is it assigning it to? Is it only useful at 
the time of module/class definition? That seems limited, how often does such 
a variable get used? I don't think I ever have.

It almost seems like  a  could be an instance variable with a default value of 
[1,2,3].  It certainly would be consistant with how block scoping works. I 
wonder why @a was chosen over this.

-t0