[MacRuby] #1090: Method persists after undef

MacRuby ruby-noreply at macosforge.org
Fri Dec 31 01:20:53 PST 2010


#1090: Method persists after undef
--------------------------------+-------------------------------------------
 Reporter:  mjkaelbling@…       |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  major               |   Milestone:  MacRuby 0.8          
Component:  MacRuby             |    Keywords:  undef undef_method   
--------------------------------+-------------------------------------------
 Below, Fixnum#x was undefined prior to 2.x but x_2 is still output, and
 the second attempt to undefine it raises NameError.

 $ macruby -v -e 'class Fixnum; def x; puts "x_#{self}" end end; 1.x; class
 Fixnum; undef x end; 2.x; class Fixnum; undef x end'

 {{{
 MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
 x_1
 x_2
 -e:1:in `<main>': undefined method `x' for class `Fixnum' (NameError)
 }}}

 Note: NoMethodError is produced if we immediately undefine Fixnum#x, the
 intervening usage 1.x appears to be critical in reproducing the error
 behavior above.

 $ macruby -v -e 'class Fixnum; def x; puts "x_#{self}" end end; class
 Fixnum; undef x end; 2.x; class Fixnum; undef x end'
 {{{
 MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
 -e:1:in `<main>': undefined method `x' for 2:Fixnum (NoMethodError)
 }}}

 The same behavior is visible in macirb -- DietRB (0.6.1)

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



More information about the macruby-tickets mailing list