From: daz Date: 2005-07-06T20:10:08+09:00 Subject: Re: Object#=~ Yukihiro Matsumoto wrote: > Hi, > > Ryan Davis writes: > > |Since Rexexp#=~ and String#=~ return nil if they fail to match, > |shouldn't Object#=~ return nil as well? It returns false currently. > > As far as I can say, =~ returns true (non-false) value when it > matches, and returns false value (nil or false) when it doesn't match. > Making it return nil is trivial, but I'm not sure yet to change. I > will try changing it on HEAD. > > matz. > Matz, I expected you to say that this was intentionally provided as a "third state": true - positive pattern match result nil - negative pattern match result false - don't know (no match was done) respond_to?(:=~) gives true for all objects (unless removed?) so is unproductive. But I'm not aware of any usage. Just a thought. daz