Hello, i have asked this question here: https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. Is ActiveSupport::OrderedHash going to be maintained in Rails? Its API page disappeared. I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it is not called OrderedHash). Thank you, Alexey. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Why don''t you want to rely on it? It''s documented behaviour, so you can totally rely on it. On Thu, Jul 14, 2011 at 5:47 PM, Alexey <alexey.muranov@gmail.com> wrote:> Hello, i have asked this question here: > https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. > Is ActiveSupport::OrderedHash going to be maintained in Rails? > Its API page disappeared. > I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it > is not called OrderedHash). > Thank you, > Alexey. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
If your target deployment is Ruby 1.9, you *should* use Hash that come with Ruby. It''s guaranteed to be sorted, and it doesn''t have the same overhead that AS::OrderedHash has. Do you know that AS::OrderedHash is an array within array, and it''s very slow? Hash in 1.9 is written in C, and doesn''t suffer the same slowness. - Prem On Jul 14, 2011, at 9:37 PM, Andrew Kaspick wrote:> Why don''t you want to rely on it? It''s documented behaviour, so you > can totally rely on it. > > On Thu, Jul 14, 2011 at 5:47 PM, Alexey <alexey.muranov@gmail.com> wrote: >> Hello, i have asked this question here: >> https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. >> Is ActiveSupport::OrderedHash going to be maintained in Rails? >> Its API page disappeared. >> I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it >> is not called OrderedHash). >> Thank you, >> Alexey. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> To unsubscribe from this group, send email to >> rubyonrails-core+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-core?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Yes, it''s going to be maintained, probably until version 4.0 of Rails that will drop Ruby 1.8 support -- Guille On Thursday, July 14, 2011 at 5:47 PM, Alexey wrote:> Hello, i have asked this question here: https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. > > Is ActiveSupport::OrderedHash going to be maintained in Rails? > Its API page disappeared. > I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it is not called OrderedHash). > > Thank you, > > Alexey. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On Thu, Jul 14, 2011 at 03:47:54PM -0700, Alexey wrote:> Hello, i have asked this question here: > https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. > > Is ActiveSupport::OrderedHash going to be maintained in Rails? > Its API page disappeared. > I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it > is not called OrderedHash).We won''t remove it until Rails 4. Even then, I''m not sure it will be removed. It will just == Hash. -- Aaron Patterson http://tenderlovemaking.com/
Andrew, i read that many disagreed with Hash''s being ordered, and i think they have a reason for that. After all, it is called Hash. So i was wondering if i could use a more appropriately named structure for an ordered hash (even if it will be identical with Hash in implementation). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/mShDfCpsaX8J. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Thank you all for explanations. Alexey. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/MohlI49FUlEJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
I also think that documenting this behavior of Hash could be a mistake, if some day there will exist a better implementation of a pure has than a doubly-circular linked list as in Ruby 1.9 (some kind of a tree?) Alexey. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/ElJfSzaIQiIJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
If you''re on 1.9 there is no slowdown with using OrderedHash vs Hash, as OrderedHash basically just inherits from Hash and does nothing else. https://github.com/rails/rails/blob/master/activesupport/lib/active_support/ordered_hash.rb#L51 On Thu, 2011-07-14 at 22:05 -0400, Prem Sichanugrist wrote:> If your target deployment is Ruby 1.9, you *should* use Hash that come with Ruby. It''s guaranteed to be sorted, and it doesn''t have the same overhead that AS::OrderedHash has. > > Do you know that AS::OrderedHash is an array within array, and it''s very slow? Hash in 1.9 is written in C, and doesn''t suffer the same slowness. > > - Prem > > On Jul 14, 2011, at 9:37 PM, Andrew Kaspick wrote: > > > Why don''t you want to rely on it? It''s documented behaviour, so you > > can totally rely on it. > > > > On Thu, Jul 14, 2011 at 5:47 PM, Alexey <alexey.muranov@gmail.com> wrote: > >> Hello, i have asked this question here: > >> https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. > >> Is ActiveSupport::OrderedHash going to be maintained in Rails? > >> Its API page disappeared. > >> I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it > >> is not called OrderedHash). > >> Thank you, > >> Alexey. > >> > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Ruby on Rails: Core" group. > >> To view this discussion on the web visit > >> https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. > >> To post to this group, send email to rubyonrails-core@googlegroups.com. > >> To unsubscribe from this group, send email to > >> rubyonrails-core+unsubscribe@googlegroups.com. > >> For more options, visit this group at > >> http://groups.google.com/group/rubyonrails-core?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > > >-- http://jonathanleighton.com/
Thanks Jon, this is the kind of a solution i was hoping for. Alexey. On Jul 15, 12:55 pm, Jon Leighton <j...@jonathanleighton.com> wrote:> If you''re on 1.9 there is no slowdown with using OrderedHash vs Hash, as > OrderedHash basically just inherits from Hash and does nothing else. > > https://github.com/rails/rails/blob/master/activesupport/lib/active_s... > > > > > > On Thu, 2011-07-14 at 22:05 -0400, Prem Sichanugrist wrote: > > If your target deployment is Ruby 1.9, you *should* use Hash that come with Ruby. It''s guaranteed to be sorted, and it doesn''t have the same overhead that AS::OrderedHash has. > > > Do you know that AS::OrderedHash is an array within array, and it''s very slow? Hash in 1.9 is written in C, and doesn''t suffer the same slowness. > > > - Prem > > > On Jul 14, 2011, at 9:37 PM, Andrew Kaspick wrote: > > > > Why don''t you want to rely on it? It''s documented behaviour, so you > > > can totally rely on it. > > > > On Thu, Jul 14, 2011 at 5:47 PM, Alexey <alexey.mura...@gmail.com> wrote: > > >> Hello, i have asked this question here: > > >>https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. > > >> Is ActiveSupport::OrderedHash going to be maintained in Rails? > > >> Its API page disappeared. > > >> I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it > > >> is not called OrderedHash). > > >> Thank you, > > >> Alexey. > > > >> -- > > >> You received this message because you are subscribed to the Google Groups > > >> "Ruby on Rails: Core" group. > > >> To view this discussion on the web visit > > >>https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. > > >> To post to this group, send email to rubyonrails-core@googlegroups.com. > > >> To unsubscribe from this group, send email to > > >> rubyonrails-core+unsubscribe@googlegroups.com. > > >> For more options, visit this group at > > >>http://groups.google.com/group/rubyonrails-core?hl=en. > > > > -- > > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-core?hl=en. > > --http://jonathanleighton.com/ > > signature.asc > < 1KViewDownload-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Nice! I didn''t know this. Thanks for sharing :) On Jul 15, 2011, at 6:55 AM, Jon Leighton wrote:> If you''re on 1.9 there is no slowdown with using OrderedHash vs Hash, as > OrderedHash basically just inherits from Hash and does nothing else. > > https://github.com/rails/rails/blob/master/activesupport/lib/active_support/ordered_hash.rb#L51 > > On Thu, 2011-07-14 at 22:05 -0400, Prem Sichanugrist wrote: >> If your target deployment is Ruby 1.9, you *should* use Hash that come with Ruby. It''s guaranteed to be sorted, and it doesn''t have the same overhead that AS::OrderedHash has. >> >> Do you know that AS::OrderedHash is an array within array, and it''s very slow? Hash in 1.9 is written in C, and doesn''t suffer the same slowness. >> >> - Prem >> >> On Jul 14, 2011, at 9:37 PM, Andrew Kaspick wrote: >> >>> Why don''t you want to rely on it? It''s documented behaviour, so you >>> can totally rely on it. >>> >>> On Thu, Jul 14, 2011 at 5:47 PM, Alexey <alexey.muranov@gmail.com> wrote: >>>> Hello, i have asked this question here: >>>> https://www.ruby-forum.com/topic/2140803, but maybe you can answer quickly. >>>> Is ActiveSupport::OrderedHash going to be maintained in Rails? >>>> Its API page disappeared. >>>> I do not want to rely on Hash''s being ordered in Ruby 1.9 (mainly because it >>>> is not called OrderedHash). >>>> Thank you, >>>> Alexey. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Ruby on Rails: Core" group. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msg/rubyonrails-core/-/FsZLFviGct0J. >>>> To post to this group, send email to rubyonrails-core@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> rubyonrails-core+unsubscribe@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/rubyonrails-core?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. >>> To post to this group, send email to rubyonrails-core@googlegroups.com. >>> To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. >>> For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >>> >> > > -- > http://jonathanleighton.com/-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.