[MacRuby] #600: hash access
#600: hash access -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.6 Component: MacRuby | Keywords: hash -------------------------------------+-------------------------------------- Here are a couple of examples that probably should not behave like that. {{{
NSUserDefaults.standardUserDefaults['oreilly.owned_books'] = [{:topic => 'macruby', :isbn => '9781449380373'}] => [{:topic=>"macruby", :isbn=>"9781449380373"}] NSUserDefaults.standardUserDefaults['oreilly.owned_books'].first[:isbn] => nil
NSUserDefaults.standardUserDefaults['oreilly.owned_books'].first['isbn'] => "9781449380373" }}}
problem: The hash item defined by a key being a symbol is only available using a string key. {{{ % macirb irb(main):001:0> { 'foo' => 'foo', :foo => :foo } => {"foo"=>"foo", :foo=>:foo} irb(main):002:0> h = _ => {"foo"=>"foo", :foo=>:foo} irb(main):003:0> NSDictionary.dictionaryWithDictionary(h) => {"foo"=>"foo"} }}} Entries using a symbol or a string key should not be merged. During an offline discussion, Laurent said: Very likely a problem with the copy functionality of symbol. -- Ticket URL: <http://www.macruby.org/trac/ticket/600> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby