From: Patrick May Date: 2004-09-04T12:51:30+09:00 Subject: Re: Hashes and ordering On Friday, September 3, 2004, at 11:39 PM, Hal Fulton wrote: > Markus wrote: >> Where are you going with this? There seem to be three unrelated >> things >> here: > > Well, I have been thinking along the lines of: What if we had a > built-in > ordered indexable collection in Ruby? > >> To see why this seems odd, let me recast your question in terms of >> arrays: >> > > [snip] > > Clever analogy, but you're presupposing an unordered arbitrarily > indexable > collection. A hash, like our Hash, is inherently unordered, but I am > imagining a similar ordered data structure. > > It's more like: > > x = [1,2] > y = [2,1] > x == y # false - we *do* depend on this being false > > I'm envisioning a data structure that has an order, but is otherwise > (in > behavior, not implementation) like our current Hash. > > I don't want to go into detail about what I'm thinking at the moment. > > But I can see where my post was unclear or vague and would raise > very valid questions in your mind. php's arrays are like this: http://www.php.net/manual/en/language.types.array.php They are pretty useful primitives. I wouldn't mind having one of these in ruby :-) Cheers, Patrick