Tim Hunter wrote:

> <posted & mailed>
> 
> Richard Dale wrote:
> 
>> Tim Hunter wrote:
>> 
>>> Frequently. Google comp.lang.ruby for 'duck typing' and be prepared for
>>> a lot of reading. Warning: it's a divisive topic.
>> No, not really - I don't see this as divisive - what is the opposing
>> opinion? You can can line up your target ducks with less fuss with my
>> 'conforms_to?' suggestion surely? I've been reading ruby-talk for a while
>> and haven't noticed any divisive discussions about duck typing..
>>
> 
> Check out the csinterface and the interface projects on RAA. These look
> similar to your conforms_to? proposal.
> 
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/100511 is a
> good and recent summary of the duck typing issue.
Well I've read that - thanks for the link. I think that discussion is about
error checking, the assumption is that if you are a non-elephant aware node
in the elephant/boxes tree, then it's an error. Either static typing will
trap it, or responds_to? tests or runtime testing.

I don't see that finding a node in the boxes/elephants tree which doesn't
respond_to? the methods ':num_elephants' and ':elephant_weight' is a
problem/error, you just don't try calling it with elephant protocol
methods. 'conforms_to?' is a more convenient way of identifing object
behaviours than anything much to do with error checking.

-- Richard