Many good points
Many good points
Posted Nov 4, 2007 7:28 UTC (Sun) by drag (guest, #31333)In reply to: Many good points by njs
Parent article: Daniel Bernstein: ten years of qmail security
Hrm. My experience is severely limited: "Dynamicly typed" always ment to me that the type is determined when the variable is created, based on various rules. That is variable types do not have to be declared before you can use them. (although they can be if you prefer it) The opposite is "staticly typed" were you have to declare variables types before using them. And "Strongly Typed" has always ment, to me, that once the variable is created then it can't be changed. That is if you create a variable as a int you can only use it as a int. If you want to use the int's value as a string you have to create a second string variable. The type is enforced by the language. The opposite of that is "weakly typed" were a int can be a string can be a float based on the context in which it's used. That is if you make a 'int' you can use as a string if you feel like it. The type is not enforced by the language. So... C == staticly, weakly typed Perl == dynamicly, weakly typed Java == staticly, strongly typed Python == dynamicly, strongly typed For example this is not legal in python: a = "1" + 1 The "" is your way of declaring that value as a string, otherwise numbers by themselves are always interpreted as int, hex, float, and other numeric types. But, of course, none of this is hard and fast. Between numeric operators it'll do type coercion. a = 0x45 + 1.0 + 12 (so that is a hex + a float + a int) And the result would 'a' be a float. Or this could be a bit of a illusion as all these things support the 'add' function. I don't know. Maybe this is because my knowledge of all this stuff is purely from a python perspective and the language that is used is to try to help programmers understand the differences between other common languages. But otherwise thanks for the clarification on the "But isn't that example of 'dynamicly typed'?" That makes a lot of sense.
