>>>>> "K" == Keith Carter <kmarplecarter / yahoo.com> writes:

K> evals are scoped as blocks, and so variables created in them are not 
K> available outside of the block.

 No, not really. Try this

moulon% ruby -e 'eval "a = 12"; eval "p a"'
12
moulon%

 if the variable `a' was scoped, the second eval won't see it.

 This is at compile time that ruby make the difference between an access to
 a variable and a method call.

 When you write :

  eval "a = 12"
  a

 at compile time, ruby has not yet seen a variable with the name `a' and
 it think that on the second line you try to call the method `a'

 Something like this

 def a
    p 24
 end

 eval "a = 12"
 a

 When you write it

 a = 0
 eval "a = 12"
 a

 when ruby compile the third line, it know that it exist a variable with the
 name `a' (it has seen it at the first line) and this time it try to access
 the variable `a' rather than call the method #a


Guy Decoux