From: Yukihiro Matsumoto Date: 2010-02-16T23:33:52+09:00 Subject: [ruby-core:28190] Re: [Bug #1535] Hash#merge! Inside Iterator Can Cause RuntimeError Hi, In message "Re: [ruby-core:28189] [Bug #1535] Hash#merge! Inside Iterator Can Cause RuntimeError" on Tue, 16 Feb 2010 22:13:51 +0900, Yusuke Endoh writes: |So, I propose to permit only updating value of existing key, |and to always prohibit adding a new key: | | hash = { 1=>2, 3=>4, 5=>6 } | hash.each {|k, v| hash[k] = func(v) } #=> OK | hash.each {|k, v| hash[k.to_s] = v } #=> always exception | |This does not cause compatibility problem because this just |raises exception that has already been occurred indeterminately. |I'll commit the following patch to trunk unless anyone says an |objection. I think it's a good idea. Go ahead. matz.