Hal wrote: > I want insertion order. > > > Do you mean that the order should be determined by the order in > > which the pairs are added? If so, what do you do when the value > > at a key is replaced? Or just changed (internally modified)? > > Replaced/modified values -- a very good question to which I have > given no thought. If (as you said elsewhere) you are wanting something "fairly fundamental to the language" these are exactly the sorts of things you should give thought to. I've been pondering it on and off today (while shopping with my wife) and I can't see an unambiguous "least surprise" way to implement something like this. The main problem is that hashes, queues, maps, sets, arrays, etc. each provide a one of the semantically clean ways of answering the questions "what does it mean when I do..."; if none of these meet your needs, it's fairly likely that either: 1) you are looking for a linked combination of two or more well-defined collection classes, or 2) what you are looking for isn't semantically clean. The syntax question (=>, etc.) is secondary. It's not at all a good idea to provide syntactic sugar to invoke cluttered semantics. So: Are you looking for a tagged list or queue? A multimap? A ordered list of key-value pairs that supports fast sub-list extraction by key? Or...? If you had your class, what would you expect the output (and/or error message) to be for.... p [1=>2, 3=>4] p [1=>2, 3=>4, 1=>5] x = [1=>2, 3=>4, 1=>5] p x[1] x = [1=>2, 3=>4] x[3] = 6 p x x = [1=>2, 3=>4] x[3],x[1] = x[1],x[3] p x x = [1=>2, 3=>4] x << [7=>8] p x x = [1=>2, 3=>4] x += [7=>8] p x x = [1=>2, 3=>4] x << [1=>8] p x x = [1=>2, 3=>4] x += [1=>8] p x x = [1=>2, 3=>4] x << [7=>8] p x x = [1=>2, 3=>4] x |= [7=>8, 3=> 9] p x x = [1=>2, 3=>4] x &= [1=>2, 3=>9, 6=>7] p x x = [1=>2, 3=>4] x << [7=>8] p x x = [1=>2, 3=>4] x[1] = 3 p x x = [1=>2, 3=>4] x[1] += 1 p x x = [1=>'2', 3=>'4'] x[1].sub!(/2/,'3') p x x = [1=>2, 3=>4] x[1] += 1 p x x = [1=>2, 3=>4] x[3] = 6 x[1] = 7 p x x = [1=>2, 3=>4] p x.delete(1) x[3] = 6 x[1] = 7 p x x = [1=>2, 3=>4, 1=>5] p x.delete(1) x[3] = 6 x[1] = 7 p x ...and so forth. My guess is that either++ 1) you will find in answering these questions that you are really wanting a simple combination of two standard collections, or 2) you will get tangled in trying to come up with something consistent, or 3) I will learn something interesting. -- MarkusQ