From: "Hal E. Fulton" Date: 2003-08-08T08:14:40+09:00 Subject: Re: Ducktype, right? ----- Original Message ----- From: To: "ruby-talk ML" Sent: Thursday, August 07, 2003 5:41 PM Subject: Re: Ducktype, right? > I would describe "duck typing" not as a particular programming > technique, but as a way of understanding how Ruby objects present > themselves with regard to the notion of type. Any Ruby object has > the potential to be customized, so to speak, as to its behavior and > interface. So there's a kind of circularity, when it comes to > describing the type of an object: an object is of type > "the type which is the type of objects that behaves the way this object > behaves". Hence (as I understand it) the idea of "duck typing": if it > behaves (walks, quacks, etc.) like a duck, then it's a duck. Thanks for saying this so well, David. I was trying to collect my thoughts, but I think you just collected them. :) > > This is sort of like having a discovered mixin. Neat. > ^^^^^^^^^^^^^^^^^^ > > Intriguing phrase. What do you mean exactly? :-) Yeah, I wondered that, too. Original poster: Please elaborate... When I was working on _The Ruby Way_ and gathering quotations to intersperse in the material -- and I admit some of these are kind of hokey -- I was thumbing through the writings of Confucius. No, seriously. And I found a quote that I almost used, that reminded me of duck typing: "If an urn does not have the properties of an urn, can it truly be said to be an urn?" :) That may be wrong, it's from memory. Intriguing, though, isn't it? Predates Bishop Berkely, John Locke, Immanuel Kant by 2000 years. Perhaps even predates Plato. My history isn't that good. Hal -- Hal Fulton hal9000@hypermetrics.com