[Ironruby-core] Towards gems - obscure scoping bug

Wayne Kelly w.kelly at qut.edu.au
Wed Feb 20 09:12:15 EST 2008

module A
  Default = 42
  def A::foo

  def A::meth1(param = Default)
    foo {}
    puts 'OK'

  def A::meth2(param = Default)
    puts 'not OK'
    foo { foo {} }



The first method executes OK, however, the second method fails when trying to lookup the Default constant for the unspecified param. Even though the body of the second method is never executed, the  mere presence of the nested blocks causes the context scoping to get screwed up so that the second method appears to be nested directly within the global scope rather than with the scope of the module A where  the constant is defined.

BTW, these and other errors that I've been reporting aren't just random bugs, they're bugs that I've come across in my on going efforts to get gems setup running under IronRuby, so they are on the critical path to running Rails.

Cheers, Wayne.

More information about the Ironruby-core mailing list