Bugs: Browse | Submit New | Admin
ruby 1.8.4 (2005-12-24) Following code loops infinitely: a = " 12345678 "; a.scan(/\d/) {|s| a[3,2]='test'; s}
Add A Comment:
Date: 2007-05-30 01:52 Sender: Ryan Davis confirmed.
Date: 2007-05-29 23:47 Sender: Daniel Berger This was fixed by freezing the yielded object as per ruby-core: 7222. Trying to run the sample code with 1.8.6 raises a RuntimeError. Dan
Date: 2006-01-26 20:33 Sender: Paul Duncan I've posted a comment this on ruby-core at the following URL: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7220 Basically, I'm not convinced the "fix" to this problem is better than just leaving things as-is. My suggestion, and patch, is a clarification in the documentation that discourages people from modifying the receiving string inside a String#scan block.