Hi -- On Fri, 16 Dec 2005, Mark Ericson wrote: >> The thrust of duck typing, as I >> understand it, is that you just ask an object to do something -- >> without regard to its class, and quite likely without doing a >> respond_to? call first. > > I've pondered if duck typing is about an object being able to respond > to a specific method or if it is about a set of methods. I also > wonder if a mechanism like Objective-C's 'protocol' would be useful > in Ruby. Here's an example of duck typing: def x(a) puts a[1] end My x method takes an argument, and sends a message to that argument without any ceremony or preliminaries of any kind. Duck typing is really about the programmer, not the object. David -- David A. Black dblack / wobblini.net "Ruby for Rails", forthcoming from Manning Publications, April 2006!