"trans. (T. Onoma)" <transami / runbox.com> schrieb im Newsbeitrag news:200409201143.55639.transami / runbox.com... > On Monday 20 September 2004 10:59 am, Robert Klemme wrote: >> No. You *can* enumerate all elements (or all pairs) in a Hash. > > Well, there is a a subtle distinction that can be drawn: by "enumerating a > hash", it undergoes a transformation and it isn't really a hash any more > --order has imposed upon it, and hashes have no order. Hence David's sense > of > a "magic" to_a. Granted this is quite minor. There is no transformation under the hood - neither technical nor conceptual: Hash#each just presents all key value pairs in some completely contingent order. No special order "has imposed upon it". > So, I agree with you. I just think the word 'index' is the wrong word, and > source of much the "confusion". If it's really needed the word > 'enumerator' > would be better. > > each_with_enumerator{|a,e| ... } > > (Or perhaps just 'enum' for short) IMHO not. An enumerator is somthing that does the enumeration or helps with it. #each_with_key is much better. > And then each_with_index can be defined as has been suggested, per class. > For > Array it would just be an alias to the above I suppose. Probably. robert