[MacRuby-devel] [MacRuby] #201: rb_objc_define_kvo_setter does not handle the case where the user might override the regular Ruby writer method.

MacRuby ruby-noreply at macosforge.org
Thu Jan 8 02:23:34 PST 2009


#201: rb_objc_define_kvo_setter does not handle the case where the user might
override the regular Ruby writer method.
-------------------------------------+--------------------------------------
 Reporter:  eloy.de.enige@…          |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  blocker                  |   Milestone:                       
Component:  MacRuby                  |    Keywords:                       
-------------------------------------+--------------------------------------
 In my opinion, the setter created by rb_objc_define_kvo_setter should
 check if the user might have overrided the regular Ruby writer method and
 call it.

 Consider:

 {{{
 class Foo
   attr_accessor :bar

   def bar=(value)
     @bar = 'bar'
     # super # depending on the impl.
   end
 end

 f = Foo.new
 f.bar = "foo"
 f.bar # => "bar"
 f.setBar("foo")
 f.bar # => "foo"
 }}}

 The user will expect the value to always be "bar" as defined in the #bar=
 impl.

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



More information about the MacRuby-devel mailing list