From: Conrad Schneiker Date: 2001-02-20T05:42:08+09:00 Subject: [ruby-talk:11131] Re: Summary: RCR #U002 - proper new name fo r indexes Robert Feldt wrote: # On Tue, 20 Feb 2001, Jean Michel wrote: # # > I like to consider an array conceptually as a special case of hash where # > the keys are restricted to be positive integers. So I am very opposed to # > choices which make them differ more than necessary (in the spirit of # > # I fully agree with this and would like to add that its easier to # learn one method name than two... Likewise. # > >> > (a) Hash#values, Array#values # > >> > (b) Hash#values_for, Array#values_for # > >> > (g) Hash#selections, Array#selections # > >> > (h) Hash#collect_indexes, Array#collect_indexes # > >> > (f) Hash#subset, Array#subset # > # but I'd vote for Hash#elements_at/Array#elements_at or # Hash#elements/Array#elements. I'd vote for using *#values* (1st * --> "Hash", "Array"; 2nd * --> "", "_at", "_for") rather than *#elements*, which I think would be more natural and more consistent with wider usage elsewhere (read: prospective future Ruby users). For example, the "Programming Perl" authors describe the above generalization as "[A] has is just a funny kind of array in which you look values up using key strings instead of numbers. They also speak of "key/value" pairs. As one might expect, practice is mixed. Here are some additional semi-random samples: a ksh manual uses "elements", a Python manual uses "items" and "values", and a Java manual uses "entries", "objects", "values of ... type", etc. Overall, *#values* seems like the more natural generic term, which seems more likely to accommodate any subsequent future generalizations that people might discover. Conrad Schneiker (This note is unofficial and subject to improvement without notice.)