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

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

[email protected] 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

T.

On 8/24/06, thoran @ thoran. com [email protected] 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.
[email protected]:~/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/