[MacRuby] #1371: MacRuby evaluates the first method defined using define_method through #send

MacRuby ruby-noreply at macosforge.org
Mon Aug 1 15:46:21 PDT 2011


#1371: MacRuby evaluates the first method defined using define_method through
#send
------------------------------------+---------------------------------------
 Reporter:  mrada@…                 |       Owner:  lsansonetti@…        
     Type:  defect                  |      Status:  new                  
 Priority:  blocker                 |   Milestone:                       
Component:  MacRuby                 |    Keywords:  reduction            
------------------------------------+---------------------------------------
 Discovered this problem while on a crusade to eliminate string eval usage
 in hot cocoa:

 Reduction:
 {{{
 a = Module.new

 a.send :define_method, :test do |value|
   puts 'first'
 end

 a.send :define_method, :something_else do |value|
   puts 'second'
 end
 }}}

 If you run the code, it will print 'first', but not second. If you then
 swap the order of the define_method calls and run it again, it will print
 'second', but will not print 'first'.

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



More information about the macruby-tickets mailing list