[MacRuby] #553: Fixnum Does Not Appear to Map to NSNumber
#553: Fixnum Does Not Appear to Map to NSNumber -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: enhancement | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- In the context of Cocoa Bindings, Fixnum should "magically" convert to NSNumber much as String becomes NSString. Example: {{{ irb(main):001:0> i = 123.to_i => 123 irb(main):002:0> i.class => Fixnum irb(main):003:0> n = NSNumber.numberWithInt(i) => 123 irb(main):004:0> n.class => Fixnum }}} See project: http://github.com/sxross/MacRuby-Array-Cocoa-Array-Binding/ for a more concrete example of why this is important. -- Ticket URL: <http://www.macruby.org/trac/ticket/553> MacRuby <http://macruby.org/>
#553: Fixnum Does Not Appear to Map to NSNumber -------------------------------+-------------------------------------------- Reporter: cwdinfo@… | Owner: lsansonetti@… Type: enhancement | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | -------------------------------+-------------------------------------------- Changes (by martinlagardette@…): * status: new => closed * resolution: => invalid Comment: Hi! You will notice that MacRuby is actually already behaving the way you want it to: {{{ $ macirb --simple-prompt
i = 123 => 123 i.class => Fixnum n = NSNumber.numberWithInt(i) => 123 n.class => Fixnum n.objCType #NSNumber method => "l" n.unsignedIntValue #NSNumber method => 123 n.stringValue #NSNumber method => "123" n.kind_of?(Fixnum) => true n.kind_of?(NSNumber) => true
}}}
:-) -- Ticket URL: <http://www.macruby.org/trac/ticket/553#comment:1> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby