>From: "Mike Wilson" <wmwilson01 / hotmail.com> >Reply-To: ruby-talk / ruby-lang.org >To: ruby-talk / ruby-lang.org (ruby-talk ML) >Subject: [ruby-talk:10853] Re: RubyChangeRequest #U002: new proper name for >Hash#indexes, Array#indexes >Date: Thu, 15 Feb 2001 01:42:39 +0900 > > > > >>From: matz / zetabits.com (Yukihiro Matsumoto) >>Reply-To: ruby-talk / ruby-lang.org >>To: ruby-talk / ruby-lang.org (ruby-talk ML) >>Subject: [ruby-talk:10830] RubyChangeRequest #U002: new proper name for >>Hash#indexes, Array#indexes >>Date: Wed, 14 Feb 2001 15:55:05 +0900 >> >>Hi, >> >>I have to admint `indexes' is not good name, since its behavior >>(returning values corresponded to keys/indexes) not consistent with >>one of `index' (returning key/index of value). >> >>Let's face it. >> >>I decided to declare them obsolete and give proper new names in the >>future (1.7 and forth coming 1.8/2.0). Do you have any idea of good >>name for them? >> >>I'm not going to remove them, just give warning if you use them. >> >> matz. > >Array#at seems to be most similar, only it just takes 1 argument. Would it >be possible to extend that to multiple arguments and for the Hash as well? > >a = Array.new(1, 2, 3) >a.at(0) -> 1 # maybe change to [1]? >a.at(0,1) -> [1, 2] > >h = { "a" => 1, "b" => 2, "c" => 3 } >h.at("a", "b") -> [1, 2] > >Seems to follow the principle of least suprise. That and I like that >construct, it just makes sense ;) > >Mike Wilson >Unix Administrator >http://ruby.weblogs.com > Please excuse my crack smoking and replace Array.new(goof) to a = [1, 2, 3] it's too early, please forgive me Mike Wilson Unix Administrator http://ruby.weblogs.com _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com