# Re: Call for crystalization --was:A use case for an ordered

**URL:** <https://www.ruby-forum.com/t/re-call-for-crystalization-was-a-use-case-for-an-ordered/66288>\
**Category:** Ruby\
**Created:** [August 24, 2006, 4:12pm UTC](https://www.ruby-forum.com/t/re-call-for-crystalization-was-a-use-case-for-an-ordered/66288 "2006-08-24T16:12:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 24, 2006, 4:12pm UTC](https://www.ruby-forum.com/t/re-call-for-crystalization-was-a-use-case-for-an-ordered/66288/1 "2006-08-24T16:12:07Z")

</div>

Benjohn and all,

I think our problem is that our terms are sloppy. I’d written  
yesterday that I’d mistaken the functionality of Hash for  
AssociativeArray, and then today I find this:

“Hashes (sometimes known as associative arrays or dictionaries) are  
similar to arrays, in that they are indexed collectives of object  
references.”

OK, so who wrote that? Dave and Andrew on page 37 of Programming  
Ruby, First Edition.

See! We’re all confused. (Can I blame you Dave, or Andrew, for my  
confusion?)

As I’ve proposed, we need to come up with a coherent taxa of  
collections or lists. We need to have one name, or possibly a bunch  
of names (as we are want in Ruby), but each name or bunch of names  
should apply to and only apply to one of each of the different  
containers that we are wanting to use.

I had an excessive taxa before which had some nonsense ones in it.  
However, and assuming we don’t go for my generalized Container or List  
or Collection, which I still think could have merit, with or without  
the automated restructuring magic, I have weeded out the ones that  
don’t make sense, so here then are the types that I think we want,  
with little respect to the goodness of, or options for each name:

Array  
Hash  
Keyed/HashedArray (with an optional sorter block, so as to indicate  
that and provide for the basis of the order, nothing = insertion  
order, block = sorted order)

I don’t like OrderedHash as a term.

And see a following post (tomorrow) I’m writing about theft.

thoran

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 24, 2006, 8:20pm UTC](https://www.ruby-forum.com/t/re-call-for-crystalization-was-a-use-case-for-an-ordered/66288/2 "2006-08-24T20:20:48Z")

</div>

removed\_email\_address@domain.invalid wrote:

> OK, so who wrote that? Dave and Andrew on page 37 of Programming
> 
> that and provide for the basis of the order, nothing = insertion  
> order, block = sorted order)
> 
> I don’t like OrderedHash as a term.
> 
> And see a following post (tomorrow) I’m writing about theft.

I say just call it Dict or Dictionary, since hashes are also known by  
this name, but the name also implies a sorting order.

There’s already a red-black tree wrtten in C, looks like it might evne  
have a Dict class already. I imagine this would make an excellent  
caniddate for the purpose.

[http://www.geocities.co.jp/SiliconValley-PaloAlto/3388/rbtree/README.html](http://www.geocities.co.jp/SiliconValley-PaloAlto/3388/rbtree/README.html)

T.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 25, 2006, 5:35am UTC](https://www.ruby-forum.com/t/re-call-for-crystalization-was-a-use-case-for-an-ordered/66288/3 "2006-08-25T05:35:54Z")

</div>

On 8/24/06, thoran @ thoran. com [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> OK, so who wrote that? Dave and Andrew on page 37 of Programming  
> Ruby, First Edition.
> 
> See! We’re all confused. (Can I blame you Dave, or Andrew, for my  
> confusion?)

There’s nothing wrong with that statement. Hashes are indexed  
collections of object references. (the 2nd ed uses collections rather  
than collectives in that sentence). There’s nothing to say that  
indices need to be integers.

And while we’re at it why hasn’t anyone cried out for the need for an  
“order preserving” array in ruby.  
rick@bill:~/ruby-1.8.4$ irb  
irb(main):001:0\> a =[]  
=\> []  
irb(main):002:0\> a[2] = 3  
=\> 3  
irb(main):003:0\> a  
=\> [nil, nil, 3]

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)
