From: Dumaiu Date: 2006-07-26T14:10:04+09:00 Subject: Re: I'll have the duck! 7rans wrote: ... > > Well, besides the fact that all code is the implementation of a way of > thinking, have you considered that you may be restricting the concept > arbitrarily? You say DuckTyping is like ElegantWay, and yet I was able > to use DuckType in psuedo-code in a meaningful way. I'd like to see you > do the same with ElegantWay. If what you say is true, how is that > possible? > ... # yadda-yadda > A valid semantic point--'ElegantWay' isn't a one hundred per-cent fit for a likeness; but it made me laugh, and it's the sort of example I was trying to think of but couldn't. Still, I am becoming increasingly convinced that Mr. Black is right and duck typing cannot effectively be modularized. To recap: Duck typing is the near absence of type checking in the Ruby core language. It's a consequence of Ruby's completely dynamic nature and the lack of distinction between method definition and method call. I think Dave Thomas called attention to and named it because its appearance was almost accidental and it was interesting enough to deserve a head-on approach, or at least consideration of one. But conceptually it's still an absence of something (type validation)--a vacancy. A 'TypeChecking' module might be useable, but one for duck typing would be a 'NoTypeChecking' module, i.e., empty. You'd be trying to automate the act of leaving something undone. Actually, it makes me think of the 'Acme::Don't' module on CPAN. The elimination of any reliance on class hierarchies really would leave you with a prototype-based model.