From: matz@... (Yukihiro Matsumoto) Date: 2001-11-23T23:39:11+09:00 Subject: [ruby-talk:26230] Re: String#== : Why not error with different type? Hi, In message "[ruby-talk:25907] String#== : Why not error with different type?" on 01/11/20, Ryo Furue writes: |I think it would be nice if String#== raised error if the argument |isn't a String. No. It makes something harder in dynamic typed languages like Ruby. For example, where ary is a non homogeneous array. ary.select{|x| x == "foo"} should be protected like ary.select{|x| begin x == "foo" rescue TypeError; false; end} It's sort of like static typing. You can use <=> for String-only comparison. "abc" <=> "abc" # 0, means same "abc" <=> 2 # error matz.