I'm sorry, I somewhat omitted some of my case when I first wrote.
I did not mean to imply that static type checking was _only_ good for performance reasons. It can also considerably enhance code correctness, as several others have pointed out.
However, as with most things, there comes a point of diminishing returns. Trying to statically check __too__ much leads to a very complex and difficult to understand type systems.
IMHO, Scala is at the verge, if not slightly over the line, for this limit.
Again, I'll say; a language like Groovy which permits type declarations (I realize Groovy decls are not checked at compile time, but that's a detail), while allowing "duck-typing" when necessary, would be appropriate. My belief is that most programmers would declare 90%+ of their types, greatly reducing errors and potentially increasing runtime speed. Most of the rest of the type errors would be easily caught by unit tests. A trivial fraction would escape into a release product--small enough, IMHO, to make up for the increased productivity and ease of use of a "mostly static" type system.
Until we have such a language (if ever) such discussions will, unfortunately, be rather academic. However, one thing I'm willing to say without qualification, and as someone who spent much of a Ph.D. doing functional languages, including O'Caml, Haskell, Concurrent Clean, etc: The current type system for Scala is too scary for most programmers, and to the extent that it is emphasized, will scare off support.
Wish that weren't the case,
Ken McDonald
On Sep 30, 2010, at 5:47 PM, Russ Paielli wrote:
On Thu, Sep 30, 2010 at 2:13 PM, Kenneth McDonald
<kenneth.m.mcdonald <at> sbcglobal.net> wrote:
One final note. My experience with Python has convinced me that compile-time type-checking is _vastly_ overrated. 90%+ of my type errors in Python are revealed in simple testing, and the remainder aren't typically difficult to track down. I have great respect for the work Martin Odersky et al have done, but I question if it's really necessary. I wish this topic didn't suck away so much really superior talent.
Python is great for getting something out the door fast (as you said about Perl), but as others have said, it is not very good for maintainability (for larger projects at least).
I am converting some of my own Python code to Scala. Part of the process is declaring method argument types, of course. I had always assumed that would be simple, but sometimes it is not. In some cases, figuring out the argument types in my own code is a non-trivial problem. But I now realize that just having those types explicitly declared reduces confusion and improves readability considerably. In fact, if the return type of a method is not trivially clear, explicitly declaring it also improves readability.
Russ P.
--
http://RussP.us