On Oct 10, 2005, at 10:52 AM, Devin Mullins wrote:

> Logan Capaldo wrote:
>
>
>> 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.
>
>
>

Ah yes but in  my imaginary ruby, your call to mod.class_eval would  
not take a string, and so it too could be subjected to static  
analysis. Of course ideally we would just have programmatic access to  
everything and not need an eval at all, instead of programmatic  
access to ALMOST everything.