From: Yukihiro Matsumoto Date: 2009-10-04T22:39:05+09:00 Subject: [ruby-core:25933] Re: [Bug #2114] Array Hash inconsistency Hi, In message "Re: [ruby-core:25835] [Bug #2114] Array Hash inconsistency" on Tue, 29 Sep 2009 17:29:47 +0900, Wim Yedema writes: |I believe the essence of a Hash table is the mapping from key to value. This mapping is a surjective function a key maps to one value but multiple keys can map to the same value. This essence does not seem to be represented by modelling the Hash as a collection of key-value pairs. It allows the a key to occur multiple times and to map to different values. This essence is also present in Arrays, but in a more specialized form where keys are integers. For me this is the reason to prefer this view. Seeing Hash as collection of key-value pair does not directly mean allowing keys to appear multiple times. For example, Set is a collection of values, but the value should be unique. |Be that as it may, it's not worth it to break a lot of existing code over this. It might be nice to provide an alternate interface to the Hash implementation, such that a programmer can choose his favorite view. Proposal for API is welcome. matz.