[MacRuby] #531: make #[] and alias for #objectForKey
#531: make #[] and alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Quite often, Cocoa classes use the #objectForKey method, for instance: {{{ NSLocale.currentLocale.objectForKey(NSLocaleCalendar) }}} I think that it would a lot of the API calls would look better if they would follow the usual Ruby collection API: {{{ NSLocale.currentLocale[NSLocaleCalendar] }}} It's not much but it's a bit like other existing shortcuts: foo= and foo? for setFoo and isFoo. -- Ticket URL: <http://www.macruby.org/trac/ticket/531> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:1> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Comment(by lsansonetti@…): What about mapping #[]= to setObject:forKey: too? -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:2> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Comment(by mattaimonetti@…): I like it :) -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:3> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Comment(by lsansonetti@…): Thibault, this is a good and not-difficult bug to let you hack on the dispatcher :) The idea is to shortcut #[] and #[]= to these methods in case they do not exist yet. This should be added in the same place we shortcut #foo= and #foo? for the respective setFoo: and isFoo: methods. -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:4> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: assigned Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Changes (by martinlagardette@…): * status: new => assigned -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:5> MacRuby <http://macruby.org/>
#531: make #[] an alias for #objectForKey -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: martinlagardette@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: | -------------------------------------+-------------------------------------- Changes (by martinlagardette@…): * status: assigned => closed * resolution: => fixed Comment: Implemented in r3244 :-) -- Ticket URL: <http://www.macruby.org/trac/ticket/531#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby