News for hackers. Stuff that matters.
Re:Ruby 1.9 Internals: Ordered Hash by bprater on Wednesday February 04, 2009 @05:28PM (#466648)
Man, who doesn't need an ordered hash from time-to-time?

The big problem is that most people assume a hash isn't ordered -- so when looking at Ruby source, I wonder if this is going to be confusing for awhile?

Re:Ruby 1.9 Internals: Ordered Hash by dasil003 on Wednesday February 04, 2009 @05:50PM (#466676)
Shouldn't be too bad. After all, it's a strict superset of the functionality of the old hash. The only confusion will come when someone looks at some code and notices, "Hey, shouldn't this be an ordered hash?" Then they go google "ruby ordered hash" and this blog post pops up and problem solved.
Re:Ruby 1.9 Internals: Ordered Hash by litewulf on Thursday February 05, 2009 @02:11AM (#467313)
Basically it'd be nice if you could distinguish between instances where iteration order is important and not important. A separate datatype would do that (at the expense of other things, obviously)
Re:Ruby 1.9 Internals: Ordered Hash by ivey on Thursday February 05, 2009 @10:48AM (#468023)
If you're worried about it in your app, you could always do

  class OHash < Hash ; end
And use OHash as a marker that you're taking advantage of the ordering features.

Over time, though, I think this will be a real plus for people learning programming via Ruby. Non-ordered hashes are non-intuitive if you don't know what "hash" means, and think it's just a dictionary.