# Hey! where's #count?

**URL:** <https://rubytalk.org/t/hey-wheres-count/651>\
**Category:** ruby-talk\
**Created:** [13 July 2002 05:52 UTC](https://rubytalk.org/t/hey-wheres-count/651 "2002-07-13T05:52:23Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [15 July 2002 16:58 UTC](https://rubytalk.org/t/hey-wheres-count/651/21 "2002-07-15T16:58:23Z")

</div>

> Be careful with that assumption. I believe that as a hash expands it  
> occasionally needs to re-hash it's keys, and that would alter the order.  
> I don't know that Ruby's hash works that way, but most of the ones I've  
> encountered do.

See [ruby-talk:44548] and [ruby-talk:12151], there is

&nbsp;&nbsp;"(if you don't modify the hash)"

Guy Decoux

---

<div class="post-metadata">

**Author:** ![Tom\_Sawyer](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Tom\_Sawyer](https://rubytalk.org/u/Tom_Sawyer)\
**Post date:** [15 July 2002 09:18 UTC](https://rubytalk.org/t/hey-wheres-count/651/22 "2002-07-15T09:18:21Z")

</div>

> I use it in this case

what case? i’d like to see an example. i worry about depending on that.  
what if something changes in Ruby 1.7+ and the orders start coming out  
different?

~transami

> **···**
>
> On Mon, 2002-07-15 at 03:12, ts wrote:
> 
> > > how do you utilize that order?
> > 
> > I use it in this case
> > 
> > > > Well, try #each, #keys and #values and you’ll see that the objects are  
> > > > given in the same order : this is (for me) important
> > 
> > Guy Decoux
> 
> –  
> ~transami
> 
> _(")_ dobee dobee do…  
> \v/  
> ^ ^

---

<div class="post-metadata">

**Author:** ![Michael\_Campbell1](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Michael\_Campbell1](https://rubytalk.org/u/Michael_Campbell1)\
**Post date:** [15 July 2002 17:40 UTC](https://rubytalk.org/t/hey-wheres-count/651/23 "2002-07-15T17:40:39Z")

</div>

> > Be careful with that assumption. I believe that as a hash  
> > expands it  
> > occasionally needs to re-hash it’s keys, and that would alter  
> > the order.  
> > I don’t know that Ruby’s hash works that way, but most of the  
> > ones I’ve  
> > encountered do.
> 
> See [ruby-talk:44548] and [ruby-talk:12151], there is
> 
> “(if you don’t modify the hash)”

It’s probably a semantic argument at this point and what is working  
for you seems to work for you, but I’d would NOT call a data  
structure which maintains an order with no relationship to the order  
that the items were inserted, and can (and will!) change its order  
whenever its contents are changed “ordered”.

But again, that’s me.

> **···**
>
> ## =====
> 
> Use your computer to help find a cure for cancer: [Webspace nicht erreichbar](http://members.ud.com/projects/cancer/)
> 
> Yahoo IM: michael\_s\_campbell
> 
> * * *
> 
> Do You Yahoo!?  
> Yahoo! Autos - Get free new car price quotes  
> [http://autos.yahoo.com](http://autos.yahoo.com)

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [15 July 2002 09:26 UTC](https://rubytalk.org/t/hey-wheres-count/651/24 "2002-07-15T09:26:08Z")

</div>

> what case? i'd like to see an example. i worry about depending on that.

[ruby-talk:12123]

> what if something changes in Ruby 1.7+ and the orders start coming out  
> different?

[ruby-talk:12151]

Guy Decoux

[Previous page](https://rubytalk.org/t/hey-wheres-count/651.md?page=1)
