From: "ara.t.howard" Date: 2009-09-30T06:18:59+09:00 Subject: [ruby-core:25865] struggling to convince myself 1.9's constant lookup rules make any sense i have the following issue in a library, here distilled minmally: cfp:~/src/git/tagz > cat a.rb module Tagz def Tagz.singleton_class(&block) @singleton_class ||= ( class << Tagz self end ) block ? @singleton_class.module_eval(&block) : @singleton_class end module XChar EscapeProc = lambda{|*values| 42 } Tagz.singleton_class{ define_method(:escape_proc){ EscapeProc } } end end p Tagz.escape_proc() cfp:~/src/git/tagz > ruby18 a.rb # cfp:~/src/git/tagz > ruby19 a.rb a.rb:13:in `block (2 levels) in ': uninitialized constant Module::EscapeProc (NameError) from a.rb:17:in `
' and i understand that constant lookup in 1.9 is different - occuring in the caller's dynamic lookup chain - but i am really struggling to see how this behavior can be called correct with respect to closures. in the above code changing from a constant to a variable - or fully scoping the contant - are both obvious fixes. however i don't understand how this new behavior isn't at odds with the fundamental concept of 'closure': can a closure which only encloses *some* of it's state really be called a closure? regards.