From: William Djaja Tjokroaminata Date: 2002-09-20T03:41:34+09:00 Subject: Re: select and select Hi, I do not like that the Array "at" method is overloaded. I think currently one advice in Ruby is to prefer "arr.at(i)" to "arr[i]" because in "arr[i]" the intrepreter needs to check the type of i. If Array "at" is overloaded like below, probably the corresponding C function will be modified from static VALUE rb_ary_at (VALUE ary, VALUE pos) to static VALUE rb_ary_at (VALUE self, VALUE args) which means more overhead, as every time the Array "args" has to be created, or to static VALUE rb_ary_at (int argc, VALUE *argv, VALUE self) { VALUE args; rb_scan_args (argc, argv, "0*", &args); .... with the same effect. Regards, Bill ============================================================================ dblack@candle.superlink.net wrote: >> |I think I would still like this better: >> | >> | arr.at(0,2,4).select { |s| s == "c" } >> >> I admit this is better in some aspect. >> >> Does "at" takes multiple placement make you feel natural? >> And is this natural for Hashes? > For Arrays I do like at(x,y,z). It seems natural to me. For Hashes, > I don't think I usually refer to a value as being "at" a key... but it > sounds sort of right.