D
Daniel Mendler
Hi,
what happend to the constant lookup rules in ruby 1.9? It seems
constants in blocks that are evaluated with instance_eval are looked up
only in the evaluating class but not in the scope the block was defined.
This works in Ruby 1.8 but not in 1.9:
======================================
class X
def run(&block)
instance_eval(&block)
end
end
module A
I_AM_NOT_FOUND = 666
a = X.new
a.run {
puts I_AM_NOT_FOUND
}
end
Ruby 1.8 finds the constants only if they are in the scope where the
block is defined. Why was this behaviour changed?
Daniel
what happend to the constant lookup rules in ruby 1.9? It seems
constants in blocks that are evaluated with instance_eval are looked up
only in the evaluating class but not in the scope the block was defined.
This works in Ruby 1.8 but not in 1.9:
======================================
class X
def run(&block)
instance_eval(&block)
end
end
module A
I_AM_NOT_FOUND = 666
a = X.new
a.run {
puts I_AM_NOT_FOUND
}
end
Ruby 1.8 finds the constants only if they are in the scope where the
block is defined. Why was this behaviour changed?
Daniel