From: Wilkes Joiner Date: 2001-12-11T01:56:08+09:00 Subject: [ruby-talk:28104] Re: The benefits of dynamic typing? Hi, --- Roy Patrick Tan wrote: > given the advantages of a statically typed > language, does dynamic typing offer any benefits? > What is the reason behind ruby's dynamically > typed variables? Spending most of my development time in Java, and having spent a considerable amount of time in dynamicly typed languages like Python, Smalltalk, and Ruby, I've found that statically typed languages just get in my way. I personally think that the safety benefits are a myth, or at the very least overrated. Just look at the collection hierarchy in Java2. Iterator iter = someList.iterator(); while (iter.hasNext()) { MyType o = (MyType) o.next(); o.doSumphin(); // or even uglier ((MyType)o.next()).doSumphin(); } All of this type checking is done at runtime, and the code is just plain hideous to look at, which does matter to me. If I want to do anything as general as a collection, I have to pass Object around, then cast to the appropriate type as needed. It appears to me that I lose the benefits of compile time type checking. This really gets in my way when I start coding then realize a few months later that I could generalize what I've been working on, but I have to go change all of my c lass's clients to reflect the more general type that I had failed to realize the first time I wrote the code. This may reflect on my poor understanding of the task at hand, but I like think of developing a system as a learning process. As the system grows and takes shape, my understanding grows with it. The flexibility of a dynamic language seems to suite this style of development better than a more static language. - Wilkes Joiner __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com