From: Eric Mahurin Date: 2007-08-29T22:34:58+09:00 Subject: Re: Duck Typing in other languages? On 8/29/07, Marc Heiler wrote: > Ah and if I forgot something about duck typing or similar > in other languages - maybe its interesting - please someone > feel free to point that out! Another place I've noticed similar functionality is with templates/generics in C++/Java. You write code that doesn't care about the (template/generic) classes/types. You write code for objects of template/generic classes that respond to a set of methods that you use. Compared to duck-typing in ruby, the main difference is that concrete classes that you want to use for these template/generic classes must be determined at compile-time. And of course template/generic code is extremely ugly because it has to look like static typing even those the types are variable. Also, with template/generic code, the code is replicated for each class/type combination, where with duck-typing this is not needed since finding the methods occurs at run-time.