[MacRuby-devel] [MacRuby] #246: NSMutableDictionary methods cannot retrieve values for Fixnum keys

MacRuby ruby-noreply at macosforge.org
Fri Apr 24 11:13:53 PDT 2009


#246: NSMutableDictionary methods cannot retrieve values for Fixnum keys
---------------------------------------+------------------------------------
 Reporter:  krishna.kotecha@…          |       Owner:  lsansonetti@…           
     Type:  defect                     |      Status:  new                     
 Priority:  critical                   |   Milestone:                          
Component:  MacRuby                    |    Keywords:  NSMutableDictionary Hash
---------------------------------------+------------------------------------
 In MacRuby 0.4 and current 0.5 build you can use Ruby syntax to work with
 Hashes:

 {{{
 h = {}
 h[42] = "forty-two"

 puts h[42]  # prints out "forty two"
 }}}

 This does not work if you use the NSMutatableDictionary method
 setObject:forKey:

 {{{
 h = {}
 h.setObject 'fifty-three', forKey:53
 h[53]  # will return nil
 h.valueFor(53) # will cause MacRuby to crash
 }}}

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



More information about the MacRuby-devel mailing list