matz / ruby-lang.org (Yukihiro Matsumoto) wrote in message news:<1006798005.396316.26738.nullmailer / ev.netlab.jp>...
> If you go though the unit test, bugs like that can be found easily.
> I believe static typing does not buy you much.  Just "sense of
> security", excuse, and optimization oppotunity.  They aren't worth the
> price of flexibility for most of the cases.

Thank you for the messages, Matz and Ned.

Perhaps I shouldn't have asked the abstract question (i.e., static
typing vs dynamic typing). Your answers are naturally abstract, which
I don't think I fully understand.  This may represent lack of
experience on my part.

So, let me go back to my original, more concrete question, to
summarize this thread (I hope):  Which of the following two designs is
better? and why?

Design 1: The == method of Ruby's basic components (String, Fixnum,
Hash, etc.) returns true or false only when both sides are
"comparable"; raises an exception otherwise.  For example,

	1 == 2    # => false
 	1 == 2.0  # => false
	1 == "1"  # => TypeError exception

Design 2: as in the actual Ruby (the third line above returning
false).

I've considered the problem hard and I think I understand.  I think
the earlier example Matz gave

 	ary.select{|x| x == "foo"}

is an answer.  This does have a danger, which I described earlier. 
But, design 1 would complicate this much, as he said.  And this
(perhaps) outweighs the danger.  So I'm (perhaps :) convinced.

Finally, I'd like to find a way to avoid the danger.  Could someone
tell me what "the unit test" is?  Is it RubyUnit?  Where can I find a
documentation?  I searched the Ruby-talk archive, but there too many
articles that mention RubyUnit...

Thank you,
Ryo