T. Onoma writes: 

>> 	a = [1,2,3]
>> 	def z
>> 		p a
>> 	end
>> 	z
> "Wait a minute."  Why isn't  a  available in the scope of this method 
> definition?
[snip...]
> I wonder why @a was chosen over this.

in fact,
everything but normal variables stay in scope inside a method,
everything being globals,
constants in the enclosing scope,
instance vars in the enclosing scope,
class vars in the enclosing scope.
(probly more i missed...) 

so a method body has a scope that specifically excludes normal variables.
is this useful for anything?
i'm clueless if it is. 

a workaround would be to pass a binding into the method: 

 a = "meow"
 def foo(bind)
   eval("a", bind)
 end
 foo(binding()) 

if you were evaling this method into an object or class or something,
you could set an instance var (or whatever) to the binding at time of eval,
and then make holes with the same trick: 

 a = "meow"
 obj.eval_bind = binding()
 obj.instance_eval %{
   def foo
     eval("a", @eval_bind)
   end
 } 

there may be some way to clean all this up,
or use it better,
but this at least makes it possible ^_^ 

 - martin <stillflame / FaerieMUD.org>