Many good points
Many good points
Posted Nov 4, 2007 6:32 UTC (Sun) by njs (subscriber, #40338)In reply to: Many good points by drag
Parent article: Daniel Bernstein: ten years of qmail security
> But isn't that example of 'dynamicly typed'?
Not really. The particular implementation in python and ruby (but not, AFAIK, in py3k)
requires dynamic typing because you have the same operation returning two different types
depending on the values involved. But one could just as well have a dynamically typed
language whose integer operations overflowed instead of passing to a bignum type, and a
statically typed language whose basic integer type didn't overflow because it actually *was* a
bignum type.
> I suppose pretty much all dynamicly typed languages do that also (ie visual basic and perl)
I know nothing about VB, but perl does something different and weird -- its integers seem to
overflow into floats:
$ python -c 'print (10 ** 100 == (10 ** 100 - 1))'
False
$ perl -e 'if (10 ** 100 == (10 ** 100 - 1)) { print "True\n" } else { print "False\n" }'
True
I guess most code that expects programming integers to act like mathematical integers will be
more surprised by an overflow to -2**31 than by loss of integer precision, but either would
make me nervous.
> (but also python is strongly typed.. meaning that you can't just use a string as a int and
visa versa (unlike VB, for example0)
"Strongly typed" is an annoying and vague term, but AFAICT it is usually used to mean "you
can't poke around at the raw representation of objects in machine memory using only ordinary
variable access operations".
