Matt Armstrong <matt / lickey.com> writes:

> nobu.nokada / softhome.net writes:
>
>>>  static VALUE
>>> -rb_reg_match_m(re, str)
>>> -    VALUE re, str;
>>> +rb_reg_match_m(argc, argv, re)
>>
>> Do you like it? :-)
>
> Yes, though I was thinking that if Regexp#match has the index
> argument, maybe String#match should have it too.

Actually I think the "elegant" solution to the problem is lazy string
copies.  E.g.

    s2 = s1[50..-1] # Does not actually copy data until s1 (or s2)
                    # is modified.  s1 and s2 must know they share
                    # data.
    s2 =~ /\Afoo/

I remember mention of some work being done on this, but there were
implementation problems.