Logan said:
x = 2
eval { y = 2; puts y } # x isn't in the closure cause its guaranteed
not to reference it
No it isn't, because before the 'x = 2' line, you stupidly did a
'require "pillage"', and pillage.rb (inside a gem) looks like this:
require 'binding_of_caller'
ObjectSpace.each_object(Module) do |mod|
next if rand(5) > 0
mod.instance_methods.each {|m| mod.send :undef_method, m}
mod.class_eval %{
def method_missing(meth,*args)
return super if rand(2) > 0
Binding.of_caller { |b|
args.each {|arg| eval arg,b}
}
end
}
end
Not sure why you did that. Seems to serve no purpose. Weirdo.
Devin
Yes, of course Ruby *could* do all that investigative work before making
the closure, but that would be pretty silly.
I'm not sure why I sent an email whose sole contents was "Point." I
guess I wasn't in my right mind. Do I have a right mind? Right, nevermind.