[MacRuby] #1162: Method lookup behavior incorrect after extending an object multiple times.

MacRuby ruby-noreply at macosforge.org
Fri Feb 18 08:47:19 PST 2011


#1162: Method lookup behavior incorrect after extending an object multiple times.
-------------------------------------+--------------------------------------
 Reporter:  eloy.de.enige@…          |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  blocker                  |   Milestone:                       
Component:  MacRuby                  |    Keywords:                       
-------------------------------------+--------------------------------------
 When overriding a method multiple times by extending the object with a
 module, it seems that the last method lookup path is cached, or something
 among those lines.

 {{{
 class X
 end

 module Vegetarian
   def bananas
     "are so awesome!"
   end
 end

 module Carnivore
   def bananas
     "Carnivores #{super}"
   end
 end

 x = X.new
 x.extend(Vegetarian)

 puts x.bananas
 puts x.bananas

 x.extend(Carnivore)
 puts x.bananas
 puts x.bananas
 }}}

 Running the above results in:

 {{{
 are so awesome!
 are so awesome!
 Carnivores are so awesome!
 are so awesome!
 }}}

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



More information about the macruby-tickets mailing list