From: Srinivas JONNALAGADDA Date: 2006-07-25T13:25:46+09:00 Subject: Re: I'll have the duck! On Tue, 2006-07-25 at 02:49 +0900, transfire@gmail.com wrote: > I wonder then, if we take up John Carter's notion on duck as mixin, > then Enumerable can be defined as: > > ducktype :each do > def collect > each{ |e| yield(e) } > end > ... > end > >From the code above, this appears to be going in the direction of formal 'interface' concept. If 'each' is a "ducktype", and 'each' has a set of well defined methods, except for the fact that code exists in those methods, this is tantamount to publishing an interface. >From the little that I understand, the whole concept of duck typing is about *not* being concerned with a full published interface (or, a full published inheritance) of the receiver; rather, we are only concerned with whether the receiver answers the _current_ message. I could be wrong in understanding your code example, though! Greetings, JS