4 ms·
The definition given for dynamic and static languages is not very good. The main difference is that a statically typed language has type checks preformed at com
by tikhonj 15y ago
The definition given for dynamic and static languages is not very good. The main difference is that a statically typed language has type checks preformed at compile time and a dynamically typed language has them preformed at runtime. My intro CS professor had a really good explanation for this: in a statically typed language, the variables have types where in a dynamically typed language, the values have types.
Also, his graph of languages doesn't really make any sense at all. If he just kept it as a division into groups, it would make sense, but it really looks like he's trying to say that C++ has a "weaker" (whatever that means) type system than C or that Haskell has a "weaker" type system than Scala.
Also, static typing is not always for robustness; it can also increase performance. C is a perfect example of this--it is one of the easiest languages to write bugs in but is also really fast.
Overall, I was not terribly impressed with this article--it gave poor definitions and little new insight (as far as I could tell, it just reiterated the same old cliches about static vs dynamic types without any anecdotes, experience or advice).
- joeyh 15y agoNot impressed either. It also repeats the misconception that statically typed languages make it harder to do exploratory development. But with type inference, not only do I not have to define my variable types up front, the type checking makes it very easy to explore and refactor code, especially when the exploration involves changing the types. Add in the ability of haskell to let you write your own control structures and do higher-level programming, and I find myself exploring and refactoring my code much more than I do when using a dynamic language.
- mvanveen 15y agoI'm with you. His example of dynamic typing is really an example of inferred typing.
- googletron 15y agoIf you would have read the article; clearly states what you said in the first line of your comment. Also your professor maybe right, the distinct is less clear when stated in those terms. It was never said that static typing is for robustness it does decrease the occurrence of runtime errors. I think the overall point was just to give insight on what people don't consider when making a programming language choice.