From: Michael Neumann Date: 2001-12-11T05:28:21+09:00 Subject: [ruby-talk:28135] Re: The benefits of dynamic typing? Rik Hemsley wrote: > On Monday 10 December 2001 4:56 pm, you wrote: > > > 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 is a drawback of the lack of templates in Java, not > a drawback of static typing. Well, this problem can be fixed by using the Pizza Compiler or GJ (Generic Java). I've also heard that Sun has added gerneric classes in one of it's beta version, but I'm not sure if this is correct. Regards, Michael -- Michael Neumann merlin.zwo InfoDesign GmbH http://www.merlin-zwo.de