Duck typing alows true polymorfisim

atbusbook@aol.com wrote:

Java // i dont know if there is a numeric super class for numbers

It is, confusingly enough, Number. And this is a silly example for Java, since the language lacks an abstract numerical tower, which is a very concrete deficiency of the language, and doesn't say anything about polymorphism being limited with static typing.

You could probably do that algorithm as elegantly in OcaML (splitting between integral and real number types, since those aren't unified in the language), or better Haskell which treats all numbers uniformly. Both are very, very strictly statically typed languages.

Your example doesn't prove anything about latent typing at all.

David Vallner