From: Shannon Fang Date: 2005-10-25T13:52:07+09:00 Subject: Re: RCR: Array#to_h >I think the proposal is over specialized. Why should the array elements >neccessarily become keys? This is actually the useful feature! I already said not everybody need it... However, I don't see any need to map array key to hash key: a = [1, 2, 3, 4, 5] b = {1, 2, 3, 4, 5} a[0] = 1 b[0] = 1 why we need to convert a to b?? The reason to use a hash is for fast access, not by using sequential index! Shannon > >Nobu, I agree except 1) key,value in Enumerable? 2) other clearly >polymorphic solution: > >module Enumerable > def to_h > hash = {} > each_with_index {|value,index| hash[i] = value} > hash > end >end > >Hence hash key <-> array index. And it is by definition "Enumerable". > >T. > >