From: "Joachim (München)" Date: 2008-03-31T19:55:12+09:00 Subject: Hash insertion order preservation in ruby1.9 I am glad to see that ruby1.9.0 preserves hash insertion order. It will finally allow me to generate human-readable yaml dumps without ugly workarounds. Some questions: (1) Can I rely upon hash insertion order preservation as an approved new feature of Ruby, without any risk that it may get lost again in future releases ? (2) ri1.9 says: "The order in which you traverse a hash by either key or value may seem arbitrary, and will generally not be in the insertion order." Do I understand correctly that this text is outdated ? If the answer is two times yes, then read on, please: (3) Would you agree that the almost undocumented yaml/omap class is obsolete ? Maybe, one should clearly marked it as such, or even exclude it from 1.9 ?? (4) Once hashes are ordered, new use cases will be found, and new methods will become useful. I would like to propose the following new instance methods Hash#insert_before( existing_key, other_hash ) Hash#insert_after( existing_key, other_hash ) and possibly also Hash#insert_before( existing_key, key, value ) Hash#insert_after( existing_key, key, value ) to insert new items at well defined locations. My use case, as I said before, is a hash which is dumped into human-readable yaml. Regards, Joachim