Jacob Fugal wrote:
> On 6/27/06, Eric Hodel <drbrain / segment7.net> wrote:
>> Should this me mentioned?
>>
>> $ ruby -ve "'cat \'o 9 tails' =~ '\d'"
>> ruby 1.8.5 (2006-06-27) [powerpc-darwin8.6.0]
>> -e:1:in `=~': type mismatch: String given (TypeError)
>>          from -e:1
> 
> To head of those that might ask (since I was about to before sitting
> down and thinking it through):
> 
> The exception is raised specifically for Strings while other non-Regex
> types just get order reversed because we're avoiding infinite
> recursion. ie. replacing this call:
> 
>  "cat 'o 9 tails" =~ '\d'
> 
> with this call
> 
>  '\d' =~ "cat 'o 9 tails"
> 
> doesn't help, since that second call would just be changed again back
> to the first, and we would cycle ad infinitum. (It wouldn't make much
> sense semantically, either).
> 
> By the way, but Eric's suggestion here and the original patch from
> Alex apply to the 1.8.4 branch as well as 1.8.5:
> 
>  $ ruby -ve "'cat \'o 9 tails' =~ '\d'"
>  ruby 1.8.4 (2005-12-24) [i386-linux]
>  -e:1:in `=~': type mismatch: String given (TypeError)
>          from -e:1

Yes - that's where I originally found the problem.  I was assuming it 
wouldn't want to be backported...

-- 
Alex