From: nobu.nokada@... Date: 2002-12-14T06:37:22+09:00 Subject: Re: [RCR] Global Regexp Match Mechanism (//g) Hi, At Sat, 14 Dec 2002 05:27:29 +0900, Matt Armstrong wrote: > > Why should the String keep track of the "pos" if the string has been > > mutated? In the code that I am trying to convert, if the string is > > modified, the code itself is responsible for resetting the \G > > position. IMO, the functions which prepend should invalidate the > > matchpos (e.g., nil). > > That's a solution, though as Nobu Nakada pointed out the whole idea of > having the String keep track of "pos" at all is flawed -- since it is > not thread safe. Furthermore, it doesn't seem to be appropriate to String as written in [ruby-talk:58952], IMO. "pos" function in Perl is a workaround to specify position with matching operator, whereas the operator is also a method in Ruby, there's no reason to avoid an explicit method. -- Nobu Nakada