To view parent comment, click here.
To read all comments associated with this story, please click here.
I feel that both, static and dynamic typing, can be a pain if they're forced on you. That's a problem that I encountered in C++ for example:
I'm writing some sort of function and don't yet know what sort of input it's going to take but I need some sort of temp variable. Problem: I need to declare the variable AND it's type at the same time - all squeezed into one tiny statement. Yes, I know there are templates but they're just a pain in the a**!
On the other hand, sometimes you WANT to give type information. As a comment, to increase performance and, last but not least, for polymorphism types are imho essential.
But they should be dynamic so that you could e.g. first use something as a vector with vector addition and multiplication and then use it as a list like this:
my a, b
a=(1, 2, 3)
b=(-1, 1, 0)
(a, b) are vectors
a+=b // a is now (0, 3, 3)
a/=3 // a is now (0, 1, 1)
(a, b) are lists
a+=b // a is now (0, 1, 1, -1, 1, 0)
That'd be sweet!
Some statically typed languages are introducing inferred types which you might find interesting (although I think you'd need to be dilligent in replacing their use once you're done experimenting). C# is an example, I believe in 3.0 the "var" keyword now means to use an inferred type.
Static type checking is a minor general form of testing. By giving it up you're simply adding one more test onto your unit test requirements... I see no reason to rewrite this over and over when general algorithms have been _mathematically proven_.
You admit you're going to test the typing anyway so why not just have the compiler do it?
As I pointed out before, Python has a similar tool: PyChecker. You might try reading posts before you spout off self-righteously as if we told you your favorite language was bad, which I don't think anyone has.
Python is one of my favorite languages, I use it quite often. And not just on tiny problems.





Member since:
2005-06-29
Static type checking is overrated. And does almost nothing to alleviate software complexity or reduce bugs in typical software programs. When was the last time a type error brought a project to a hault? In my experience writing programs with both statically and dynamically typed languages, type errors have been the least of my concerns. And I only realized that after writing a medium scale project in a dynamically typed languages.
What static type checking does is give impressionable developers a false sense of security. The reality is that disasterous bugs in software are only found via testing. Unit automated testing, regression testing, user testing and manual testing are the scientifically proven ways to ferret out bugs in software, not fanatically checking data types whether or not it makes sense. Type errors are cheap to discover and fix in about every language I know. Python, in particular, points you to exact function and line a possible type error may have occurred, albeit during testing.
The errors most developers have nightmares over are the ones related to design, semantics, threading (race condition, dead locks, etc), inadequate understanding of the problem space or inexperience, bugs in third party libraries, poor or lack of documentation among many others. I have yet to a see a developers grow gray hair over type errors.
Static typing is something smart compilers should manage for programs. In fact, some smart compilers already do that. Haskell's compiler has an impressive inference engine that many statically typed languages should emulate. The single significant advantage of static typing is optimization and performance tuning. Errors with respect to types are almost always insignificant and cheap to discover. A programmer's greatest challenge should be design, not fighting around needlessly with compiler errors or language semantics.