I noticed that class variables @@my_class var are now looked up in the context of the instance_eval'd object in Ruby 1.9.1 whereas this was not the case in Ruby 1.8.6.
What are some other differences in behaviour of instance_eval for Ruby 1.9.1 ?
I noticed that class variables @@my_class var are now looked up in the context of the instance_eval'd object in Ruby 1.9.1 whereas this was not the case in Ruby 1.8.6.
What are some other differences in behaviour of instance_eval for Ruby 1.9.1 ?
I can't list them all, but I know that there are some changes in constant lookup. In 1.8, constant lookup was in the callers scope, while it is in the blocks scope in 1.9.
FOO = "hi"
class Something
FOO = "bye"
def self.handle(&block)
instance_eval(&block)
end
end
p Something.handle { FOO }
# "hi" on 1.8, "bye" on 1.9