Whats the difference between statically and dynamically typed languages? what is Strong Typing and Weak Typing?
Static vs. dynamic typing
Here are some claimed benefits.
Static typing
1. Reduced CPU usage since types don’t need to be checked at run-time
2. Reduced memory usage since types don’t need to be stored at run-time
3. Other type-directed optimizations
4. Discovery of errors as early as possible, for all my code
5. statically typed language, every variable name is bound both
a) to a type (at compile time, by means of a data declaration)
b) to an object.
Dynamic typing
1. Easier to run and test since there are practically no compile-time or link-time errors
2. Programs are not limited by the expressiveness of the type system of the language
— e.g. heterogeneous data structures w/o explicit tagging.
3. Allows for implicit open recursion, late binding, dynamic scope, and duck typing
4. Programs are simpler since I don’t have to worry about types. Things are often coerced implicitly making my programs more concise, and I don’t have to use really abstract things like type variables and higher-order types. In other words, they have been abstracted away by being pushed down to a place I don’t have to think about.
5. In a dynamically typed language, every variable name is (unless it is null) bound only to an object.
Here are some claimed benefits.
Static typing
1. Reduced CPU usage since types don’t need to be checked at run-time
2. Reduced memory usage since types don’t need to be stored at run-time
3. Other type-directed optimizations
4. Discovery of errors as early as possible, for all my code
5. statically typed language, every variable name is bound both
a) to a type (at compile time, by means of a data declaration)
b) to an object.
1. Easier to run and test since there are practically no compile-time or link-time errors
2. Programs are not limited by the expressiveness of the type system of the language
— e.g. heterogeneous data structures w/o explicit tagging.
3. Allows for implicit open recursion, late binding, dynamic scope, and duck typing
4. Programs are simpler since I don’t have to worry about types. Things are often coerced implicitly making my programs more concise, and I don’t have to use really abstract things like type variables and higher-order types. In other words, they have been abstracted away by being pushed down to a place I don’t have to think about.
5. In a dynamically typed language, every variable name is (unless it is null) bound only to an object.
0 comments: