Statically Typed Languages Encourage Bad Code
python-gazette.com
python-gazette.com
The developer has to figure out the return type in Python as well, since otherwise he wouldn't know, if the returned object provides the method he is calling on it next.
fido = puppies[0]
If puppies[0] doesn't return a "dog" the following call will fail. At run time!
Anyway, you can alternatively break up the code in several lines without creating a temporary variable for each step, if it's only about readability:
string fidos_name = spot.get_puppies()
.puppies[0]
.get_name()
.upper() + "!";On the other hand, if someone seriously proficient in OCaml were to criticize static typing (in general, not just implementation details in some given language), I'd be all ears.
Loud ignorance + linkbait title? Flagged. Python is a fine language, it's too bad some of its buzz is so ignorant.
The main point is that modern static typing eliminates those stupid, tedious, verbose type annotations, as well as the stupid Python "I decided to crash because calcVaule(input) does not exist, but OMFG how could I have possibly known until I got there" errors.
The article is complaining about the problems that have been thoroughly solved for decades. Which is totally cool; if you want me, I'll be here in the corner howling about Nixon and Disco.
I've seen bad code and that isn't bad code.
I prefer dynamic languages, but come on people. A type declaration makes 'good' code 'bad'. I can't even... I mean... really? And this got 4 points so far? Yes, I'm having a disappointed in the world night otherwise I could ignore those 4 points. Still... 3 people saw this recently and thought that was a valid argument.
Sigh.
See the flag button? The glowing, shiny, happy flag button?
His argument is not really about the advantages of dynamic typing, but rather those of implicit typing, which is a more or less orthogonal concept.
Thus, as others have pointed out, Haskell, with its implicit static typing, does not have this problem.
Even C++(0x), with the new use of the "auto" keyword, allowing for implicit static typing, would not have the problem.
And Python, with its implicit dynamic typing, does not either.
But Java, with explicit static typing, does have the problem.