Hi,

In message "[ruby-talk:25907] String#== : Why not error with different type?"
    on 01/11/20, Ryo Furue <furufuru / ccsr.u-tokyo.ac.jp> 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.