From: nobu.nokada@... Date: 2003-05-24T09:45:19+09:00 Subject: Re: [Q] Change in 1.8 String#=~ intentional? Hi, At Sat, 24 May 2003 07:07:45 +0900, Warren Brown wrote: > Is this change intentional? It would seem that this change would affect > a lot of exsiting code in subtle, hard-to-find ways :o( Yes. But I think it should be warned now. Index: string.c =================================================================== RCS file: /cvs/ruby/src/ruby/string.c,v retrieving revision 1.155 diff -u -2 -p -r1.155 string.c --- string.c 19 May 2003 07:11:48 -0000 1.155 +++ string.c 24 May 2003 00:43:36 -0000 @@ -1028,4 +1028,12 @@ rb_str_match(x, y) case T_STRING: +#if RUBY_VERSION_CODE < 181 + { + VALUE r = rb_reg_quote(y); + if (r != y && rb_str_cmp(r, y) != 0) { + rb_warn("usage of String#=~ to String is deprecated; use Regexp#=~ or String#index instead"); + } + } +#endif start = rb_str_index(x, y, 0); if (start == -1) { @@ -1460,5 +1468,5 @@ get_pat(pat, quote) if (quote) { val = rb_reg_quote(pat); -#if RUBY_VERSION_CODE < 180 +#if RUBY_VERSION_CODE < 181 if (val != pat && rb_str_cmp(val, pat) != 0) { rb_warn("string pattern instead of regexp; metacharacters no longer effective"); -- Nobu Nakada