[MacRuby] #704: Singleton bug with define_method

MacRuby ruby-noreply at macosforge.org
Tue Jan 18 06:12:35 PST 2011


#704: Singleton bug with define_method
--------------------------------+-------------------------------------------
 Reporter:  mike@…              |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  major               |   Milestone:  MacRuby 1.0          
Component:  MacRuby             |    Keywords:                       
--------------------------------+-------------------------------------------

Comment(by watson1978@…):

 It seems that this issue occurs to use the same variable name in argument
 of #instance_exec and argument of block of #instance_exec.

 Test script works when I change it as follows:
 {{{
     singleton.instance_exec(name) do |m| #  # changed name -> m
       define_method("#{m}=") do |value|
         puts "Setting #{m} to #{value}"
         @values[m] = value
       end
       define_method("#{m}") do
         return @values[m]
       end
     end
 }}}

 I also think this issue is unrelated to define_method.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/704#comment:3>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list