Lots of people are commenting on Steve Yegge’s talk “Dynamic Languages Strike Back“, so I’ll add my 2 cents. I’m a hardcore Scheme & Lisp programmer, but even I will reluctantly admit that static typing is important and useful. The primary reason I still use Scheme is because I won’t ever give up macros. On to the talk: Yegge spends too much time arguing that the performance of dynamic languages can match static languages, especially since many (Java & C#) are using reflection as a poor man’s dynamism anyway. He make the classic “sufficiently smart compiler” argument, which rarely matches reality. Regardless, the raw speed of a programming language is not usually a problem for larger systems, because I/O is usually the bottleneck. So the great bulk of his talk on performance is pointless. Yes, dynamic languages could be very fast, but they won’t be and it usually doesn’t matter anyway.
Performance is the least significant feature of static typing. Instead, static typing is really an automated code review by the compiler. More importantly, it can check very large programs with many developers and lots of evolving components. The fact is that programmers use idioms in dynamic languages to provide type hints to other programmers, but not to the compiler. Furthermore, dynamically typed programs aren’t usually that dynamic. You create structures with expected types on them, and that strong typing influences the rest of your program. If a name is a string, you won’t want to assign a symbol or char there. But when you do make a mistake, a runtime error dumps you into the debugger and you have to dig around to find the offending statement. This is easy when it’s all your code, but hard when it’s a very large system written by lots of different people with different programming styles.
So if most dynamic programs are mostly strongly typed anyway, why not tell the compiler about it so it can double check your code? The problem with static type systems is (1) they are complex and (2) the compiler error messages are bizarre. A minor problem is that type systems sometimes can’t express something you’re trying to do, but there’s usually a kludge for those problems. I think that (2) is easier than the runtime error messages you get in a dynamic language, but it does takes some time to learn how to read those weird error messages. Shouldn’t someone be working on this? I have some sympathy for (1), but I think programmers need to change their mindset. It’s better to write correct code slowly than to write buggy code quickly. Though it takes longer to figure out the magic incantation to make a Haskell compiler happy, it does result in far fewer bugs. At the very least, you can write your prototypes in a dynamically typed language and production code in a statically typed language. Then you get the best of both worlds.