[MacRuby-devel] [MacRuby] #619: Constant scope in a block is determined at run-time?

MacRuby ruby-noreply at macosforge.org
Thu Feb 18 05:05:19 PST 2010


#619: Constant scope in a block is determined at run-time?
--------------------------------+-------------------------------------------
 Reporter:  chekenan@…          |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  major               |   Milestone:                       
Component:  MacRuby             |    Keywords:                       
--------------------------------+-------------------------------------------
 r3572

 Following code can't run by macruby. Both ruby 1.8.7 and 1.9.1 work.

 {{{
 module A
   B = "Not defined in top-level."

   def self.extended(base)
     base.class_eval do
       puts B
     end
   end
 end

 class C
   # Not include A
   extend A
 end
 }}}

 NameError: uninitialized constant C::B
         from /Users/dche/(irb):6:in `block'
         from /Users/dche/(irb):5:in `extended:'

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/619>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list