From: Eric Hodel Date: 2005-07-07T03:47:40+09:00 Subject: Re: Object#=~ On 06 Jul 2005, at 11:15, Eric Mahurin wrote: > --- Eric Hodel wrote: >>> true - positive pattern match result >>> nil - negative pattern match result >>> false - don't know (no match was done) >> >> daz's suggestion simply defines a convention for existing >> behavior, which feels much better to me. > > both are changes and both could cause compatibility issues. I > think either way causing a compatibility issue would be rare, > although I have to admit the unknown==nil/mismatch==false would > probably be more likely. unknown==nil and mismatch==false > seems more natural and if a change is going to be made it might > as well be done right. daz describes existing behavior, there are no changes other than adding "this is the what the return value of #=~ means" somewhere in Ruby's documentation. $ /usr/bin/ruby182 -v test.rb ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0] true - positive pattern match result 'abc' =~ /b/ # => 1 nil - negative pattern match result 'abc' =~ /z/ # => nil false - don't know (no match was done) 5 =~ /b/ # => false -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04