From: Florian Gross Date: 2003-08-18T23:47:59+09:00 Subject: Re: Bug when rerouting String#gsub with a block using $1? Yukihiro Matsumoto wrote: > Hi, Moin! > In message "Re: Bug when rerouting String#gsub with a block using $1?" > on 03/08/18, Mauricio Fern�ndez writes: > > |Is this just impossible to do in Ruby? > > In pure Ruby, yes. > > Ah, wait. If you don't need thread safety, you can do it as: > > [code snippet snipped] That's a nice hack, thank you! And I think Nobu Nakada's change even makes it thread-safe, but are you sure that the incosistent behavior of $1 in blocks passed to gsub is needed? IMHO this is a confusing trap and thus a source of unnecessary debugging sessions for users. That aside: Are there other methods like sub, sub!, gsub and gsub! which have this special behavior? > matz. Regards and thank you for designing a wonderful language, Florian Gross