Hal Fulton wrote: > Isak wrote: >> >> I don't think 'ordered' is a good name for something sorted by >> _insertion order_. > > The fact that something can be "sorted" at all is only because it > has an order, i.e., is sequential. > > In fact, I would say an "ordered hash" would be subject to being > sorted just as an array is. (We can sort an array because it has > an order -- first element, second element, and so on. We can "sort" > a regular hash, but we get an array back.) You're right. Ordered merely means that elements have a position, I had it confused with 'sorted'. >> I am probably 'tainted' by my exposure to the Java API, but just like >> I expect an ordered tree to be sorted by value, I'd expect an ordered >> map to be sorted by key. >> >> Insertion order maps are very useful too, and I'd love to see both >> added to the Ruby stdlib. I(o?)Hash and OHash? Let's keep Hash as lean >> and mean as possible. > > That seems reasonable to me. > > I once proposed the name "Map" for such a class -- there was some reason > this wasn't considered good, but I can't recall why. Yup, associated arrays are maps, not hashes. After reading the nutter's on google groups (hate the broken nntp<->mailing list concept), I realize that calling them hashes isn't appropriate. Once you change their caracteristics they aren't really hashes any more. SortedMap (or TreeMap) and (Insertion)OrderedMap (or perhaps LinkedHashMap; doubly linked list + hash) are probably better names..? Isak > > > Hal > >