> But what about all the other tests that you still have to do?
You should do those too.
> Which typically also coincidentally check the types (if I check that a value is > 2, I am also checking that its type is number
~$ python -c 'print "foo" > 2'
True
Now, on the bright side, Python 3 fixes that one:
~$ python3 -c 'print(2 < "foo")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: unorderable types: int() < str()
But most popular dynamic languages seem to have more where that came from. And if you have a sufficiently robust type system not to, then it starts to look a lot like the type system of a static language, minus the compile-time error detection.
> what is the value of "compile time", if the all this type checking makes the compiler so slow that just compiling is slower than compiling + running unit tests in a simpler language?
To the best of my knowledge, type checking is hardly the slowest part of most compilers. Many dynamic languages have somewhat faster startup times because they don't have a compiler, or they use a JIT at runtime. In any case, for many non-trivial programs, runtime dominates. A sufficiently thorough unit test suite may take significantly longer than compilation. And even if not, someone has to write the unit tests that handle what static type checking does for free.
I'm not going to claim that static typing is universally better; for instance, it's a lot harder to provide a good REPL in a statically typed language. But personally, I like dealing with as many errors as possible up front, rather than discovering them later on.