ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Michael Edgar <michael.j.edgar@dartmouth.edu>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:38698] [Ruby 1.9 - Feature #5123] Alias Hash 1.9 as OrderedHash
Date: Tue, 2 Aug 2011 16:54:22 +0900	[thread overview]
Message-ID: <redmine.journal-19977.20110802165421@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-5123.20110731161908@ruby-lang.org


Issue #5123 has been updated by Michael Edgar.


As a corollary, for a few months I had one portion of my code which used Sets, and relied on the fact that Sets in 1.9 retain their order because they in turn use a Hash. The only real way I could document this requirement was to put comments in capital letters in the relevant portions of code so that I didn't forget that I relied on this behavior.

If I had been creating "OrderedSets" (though this sounds too close to SortedSet despite meaning something different), and OrderedSets use an OrderedHash, then it would have been clear in the code that insertion order was preserved, especially for developers new to 1.9.

I like this idea.
----------------------------------------
Feature #5123: Alias Hash 1.9 as OrderedHash
http://redmine.ruby-lang.org/issues/5123

Author: Alexey Muranov
Status: Assigned
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: 
Target version: 


I read that it was a controversial decision to make Hash in Ruby 1.9 ordered.
It is not clear if the present implementation is the best possible.
I would like to express my thought.

It would be nice if the ordered Hash in Ruby 1.9 was aliased as OrderedHash.
That way people who rely on preserving the insertion order in some application (me, for example) could explicitly use OrderedHash, and developers of Ruby would be free to redefine Hash in future versions if a better implementation that a doubly-linked circular list is found.
(I read something about a possibility of using "red–black tree".)

Thanks.

Alexey Muranov.


-- 
http://redmine.ruby-lang.org

  parent reply	other threads:[~2011-08-02  7:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-31  7:19 [ruby-core:38623] [Ruby 1.9 - Feature #5123][Open] Alias Hash 1.9 as OrderedHash Alexey Muranov
2011-08-02  7:40 ` [ruby-core:38697] [Ruby 1.9 - Feature #5123][Assigned] " Kazuhiro NISHIYAMA
2011-08-02  7:54 ` Michael Edgar [this message]
2011-08-03  1:29 ` [ruby-core:38732] [Ruby 1.9 - Feature #5123] " Thomas Sawyer
2011-08-03  7:02 ` [ruby-core:38740] Re: [Ruby 1.9 - Feature #5123][Open] " Anurag Priyam
2011-08-06 22:23 ` [ruby-core:38827] [Ruby 1.9 - Feature #5123] " Alexey Muranov
2011-08-06 22:25 ` [ruby-core:38828] " Alexey Muranov
2012-10-27 15:00 ` [ruby-core:48483] [ruby-trunk " yhara (Yutaka HARA)
2012-10-31 20:09 ` [ruby-core:48680] " headius (Charles Nutter)
2012-10-31 20:29 ` [ruby-core:48683] " alexeymuranov (Alexey Muranov)
2012-11-22  1:47 ` [ruby-core:49847] " lancel (lancel lancel)
2012-11-22  6:29 ` [ruby-core:49863] " uggsoutlet (uggsoutlet uggsoutlet)
2015-12-19 11:43 ` [ruby-core:72376] [Ruby trunk " alexey.muranov
2018-02-20  8:19 ` [ruby-core:85678] [Ruby trunk Feature#5123][Rejected] " matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-19977.20110802165421@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).