Hi --

On Thu, 18 Aug 2005, Eric Mahurin wrote:

> --- "David A. Black" <dblack / wobblini.net> wrote:
>>
>> It sounds like you think I mean you should send all possible
>> messages to an object simultaneously, or something bizarre like
>> that.
>
> No, I'm only talking about how to describe a particular type
> (most likely in documentation).  I think you and I both agree
> that in normal circumstances, one's ruby code should not do any
> checking of the type - however you define it (kind_of?,
> responds_to?, etc).  Otherwise you'd be "caring" about the type
> which goes against duck-typing.

I think of respond_to? as a kind of "weak duck typing" :-)

>> Obviously any given use of an object does not recapitulate or
>> encapsulate its entire type, if "type" is defined as the object's
>> capabilities.
>
> And that is why I think this definition of "type" is not very
> useful.  The definition I gave for duck-type is quite useful in
> the context of duck-typing - for documenting arguments of
> methods.

I'm not sure how we've gotten onto documentation.  (Yes, I know it's
all part of programming responsibily....)   Anyway, if you want to
say: "This method takes an argument whose duck type is 'this object
responds to "x"'", instead of: "This method takes an argument that
responds to 'x'", be my guest :-)  I don't see what it adds.  I prefer
the shorter way.


David

-- 
David A. Black
dblack / wobblini.net