From: Florian Frank Date: 2006-10-29T04:24:09+09:00 Subject: Re: nil.to_s != "nil" Eero Saynatkari wrote: >> You are correct that "" != nil, but "nil" != nil also. >> What are you really trying to achieve? And, did you know that >> nil.inspect yields "nil"? >> > > Yes. I want consistency. > Ruby's behavior is consistent: >> "a" + nil.to_s # => "a" >> 1 + nil.to_i # => 1 >> 1.0 + nil.to_f # => 1.0 >> [1] + nil.to_a # => [1] nil.to_X always returns the neutral element for #+. Of course Matz could have chosen some other kind of consistency instead of this one. -- Florian Frank