> -----Original Message----- > From: Ondrej Bilka [mailto:neleai / seznam.cz] > Sent: Friday, February 09, 2007 1:01 PM > To: ruby-core / ruby-lang.org > Subject: Re: [ ruby-Bugs-8539 ] String:upto loops forever if > argument is modified inside block > > > On Fri, Feb 09, 2007 at 06:27:31PM +0100, noreply / rubyforge.org wrote: > > $ ruby -e '"a".upto("b") {|s| s[0] = "c" }' > > > > loops forever! > > > And what did you expect? > > Only solution is deepclone indexing variable. I dont think > performance tradeof worth it Hm, this reminds me of a bug I discovered a long time ago: http://groups.google.com/group/comp.lang.ruby/msg/92db38b74bbd38d2?hl=en & One suggestion that came up was that receivers could be temporarily frozen to prevent in-block modification. I don't know if it's possible, what the downsides are, or if it's even that important. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.