Hi --

On Fri, 26 Aug 2005, Eric Mahurin wrote:

> For example, is this considered good duck typing?
>
> klass = obj.class
> obj2 = klass.new
>
> vs. this:
>
> klass = obj.class
> if klass.equal?(String)
> ...
> end
>
> Maybe with the the original definition, neither of these are
> duck-typed because you are using Object#class.  But, in the
> spirit of duck typing, I'd say the first is good and the second
> not duck-typed.

You're shaving the concept of duck typing down to a trivial level,
while also exalting it to the status of the only important principle
in Ruby programming.

It is neither.  It is, in what I believe are the exact words of Dave
Thomas, "a way of thinking about Ruby programming."  It's not a game
of "Simon Says" ("You called #class -- you're out!")  Try to see the
broad picture :-)


David

-- 
David A. Black
dblack / wobblini.net