From: Gavin Sinclair Date: 2003-09-13T09:51:29+09:00 Subject: Re: Duck Typing On Saturday, September 13, 2003, 10:23:16 AM, Jim wrote: > [...] > I would call this an example of Duck Typing ... > class Dog > def talk > puts "Woof" > end > end > class Duck > def talk > puts "Quack" > end > end > [Dog.new, Duck.new].each { |a| a.talk } > ... even though there is no explicit method testing going on. After > all, if it walks and talks like a duck ... > So, am I off base? Not AFAIC. Testing for methods is one of those things that can sound important in theory, but who ever programs like that? After all, if the method you're after isn't supported, what are you going to do? Choose another one? ;) Of course, in frameworks and libraries there is often some funny meta-programming going on, but that's a special case, and it still runs on the old assumption that you're confident of what the code is doing. Gavin