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

2009-04-24 Thread MacRuby
#246: NSMutableDictionary methods cannot retrieve values for Fixnum keys
---+
 Reporter:  krishna.kote...@…  |   Owner:  lsansone...@…   
 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: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2009-04-24 Thread MacRuby
#246: NSMutableDictionary methods cannot retrieve values for Fixnum keys
---+
 Reporter:  krishna.kote...@…  |   Owner:  eloy.de.en...@… 
 Type:  defect |  Status:  new 
 Priority:  critical   |   Milestone:  
Component:  MacRuby|Keywords:  NSMutableDictionary Hash
---+
Changes (by eloy.de.en...@…):

  * owner:  lsansone...@… => eloy.de.en...@…


Comment:

 Very nice, thanks! Will apply this asap.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2009-04-24 Thread MacRuby
#246: NSMutableDictionary methods cannot retrieve values for Fixnum keys
---+
 Reporter:  krishna.kote...@…  |   Owner:  eloy.de.en...@… 
 Type:  defect |  Status:  new 
 Priority:  critical   |   Milestone:  
Component:  MacRuby|Keywords:  NSMutableDictionary Hash
---+

Comment(by krishna.kote...@…):

 This bug was discovered whilst I was working through the MacRuby article
 on the  (see: Mac Dev Center
 
http://developer.apple.com/mac/articles/scriptingautomation/cocoaappswithmacruby.html).

 The following is used as example code:

 {{{
 >> h.setObject 'bar', :forKey => 43
 => nil
 >> h
 => {42=>"foo", 43=>"bar"}
 }}}

 And of course, trying the following causes much confusion to the newcomer:

 {{{
 >> h[42]
 => nil
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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

2009-04-24 Thread MacRuby
#246: NSMutableDictionary methods cannot retrieve values for Fixnum keys
---+
 Reporter:  krishna.kote...@…  |   Owner:  eloy.de.en...@… 
 Type:  defect |  Status:  new 
 Priority:  critical   |   Milestone:  
Component:  MacRuby|Keywords:  NSMutableDictionary Hash
---+

Comment(by lsansone...@…):

 I cannot reproduce the crash, however I reproduce the bug.

 {{{
 $ macruby -e "h={}; h.setObject('foo',forKey:42); p h.objectForKey(42)"
 nil
 }}}

 I think this is because our Fixnum boxed class does not implement
 -[NSObject hash].

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel