[MacRuby] #152: KVC arguments not properly marshalled
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- An argument isn’t being marshalled properly to mutable array KVC accessors. {{{ class KVCTest def initialize; @a = []; end def countOfThings; @a.size; end def objectInThingsAtIndex(i); @a[i]; end end KVCTest.new.valueForKey 'things' irb(main):015:0> KVCTest.new.valueForKey 'things' TypeError: no implicit conversion from nil to integer from (irb):11:in `[]' from (irb):11:in `objectInThingsAtIndex' from bin/irb:12:in `<main>' }}} Not sure why objectInThingsAtIndex: is getting a nil arg here. -- Ticket URL: <http://www.macruby.org/trac/ticket/152> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | -----------------------------+---------------------------------------------- Comment(by ben@tanjero.com): This is really a method signature issue. -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:2> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | -----------------------------+---------------------------------------------- Comment(by ben@tanjero.com): Here’s the proposal from Rich: {{{ kvo do def countOfThings; 42; end def objectInThingsAtIndex(i); "The Answer"; end end }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:3> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: | -----------------------------+---------------------------------------------- Changes (by ben@tanjero.com): * status: new => closed * resolution: => fixed Comment: Fixed in r720 and r721. -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:4> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: fixed Keywords: | -----------------------------+---------------------------------------------- Changes (by ben@tanjero.com): * milestone: => MacRuby 0.4 -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:5> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: reopened Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: Keywords: | -----------------------------+---------------------------------------------- Changes (by ben@tanjero.com): * status: closed => reopened * resolution: fixed => Comment: Fixed key names in r743. -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:6> MacRuby <http://macruby.org/>
#152: KVC arguments not properly marshalled -----------------------------+---------------------------------------------- Reporter: ben@tanjero.com | Owner: lsansonetti@apple.com Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: fixed Keywords: | -----------------------------+---------------------------------------------- Changes (by ben@tanjero.com): * status: reopened => closed * resolution: => fixed Comment: For posterity, the final syntax is: {{{ class MathFacts kvo_array :firstTenSquares do def size; 10; end def [](i); (i+1)*(i+1); end end end
MathFacts.new.valueForKey 'firstTenSquares' => [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] }}}
and similar for kvo_set. -- Ticket URL: <http://www.macruby.org/trac/ticket/152#comment:7> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby