I think that most in the Ruby community have the same feelings towards
static typing.

Recently, I lost an argument to several people in the community on this
mailing list.  I was proposing that string concatenation should work with
any object.  So "1" + 1 ==> "11".  This is how Java works.  I found it very
useful and used it constantly.  I use it right now in ruby constantly (but I
have to add .to_s all over the place).

The reason I lost the argument was that they claimed it would cause
hard-to-find bugs if someone meant: "1".to_int + 1.  They claimed it was
ambiguous.  To me it is obvious that "1"+1 means a string and 1+"1" means an
integer (because of message passing).

I made the same argument you are making: "In five years of Java coding I
never once regretted the feature while I used it often".  And: "No one in
the Java world has complained".

Is there some way we can generalize this whole argument of "protecting
programmers from themselves" versus "more power and flexibility is better"?
If we had some general principle like this, then I could have used that
principle to win my argument.

How about calling it the "principle of freedom"?

-----Original Message-----
From: Harry Ohlsen [mailto:harryo / zip.com.au]
Sent: Monday, December 10, 2001 3:01 PM
To: ruby-talk ML; undisclosed-recipients:
Subject: [ruby-talk:28147] Re: The benefits of dynamic typing?


In article <3C153282.9000309 / vt.edu>, "Roy Patrick Tan" <rtan / vt.edu>
wrote:

> Phil Tomson wrote:
>
>> then if I, or a user of these
>> classes decide that they want a different kind of runnable object that
>> performs a differnt function when 'run' is called, all they have to do
>> is define another class of their own and make sure it's objects respond
>> to 'run'.
>
>
> This is somehow disturbing to me. "Run" is kind of ambiguous, and might
> behave differently for different objects, whereas the caller of the
> method expects "run" to behave in a certain way, shouldn't a
> compiler/interpreter make sure that  it *does* behave that way (ie check
> the contract)?

I was sold on strict typing for a very long time, because I believed it
saved me from making mistakes.

However, at this point, I definitely question the bang for buck.  I'm
absolutely certain that the number of times it may have saved me from
myself do not add up to the amount of hassle it caused in terms of the
time spent coding things "right" so that they'd compile.

I've been coding in Ruby for almost exactly a year now and I can't think
of one time when I've thought "If only the inheritance/interface
was strongly typed I would have picked up that mistake much faster".

As pointed out earlier, this is probably dependent on what you're coding
most often.