From: Robert Dober Date: 2008-05-29T20:27:16+09:00 Subject: Re: The duck's backside On Thu, May 29, 2008 at 12:37 PM, David A. Black wrote: > > The idea of duck typing, as I understand it, is to embrace this > inalterable fact about Ruby objects, rather than try to wish it away, > with ancestry checks and the like. This makes sense to me; it stands > to reason that a language with objects whose types can change during > runtime would be well-served by a programming style that deals as > directly and economically as possible with precisely that condition. I have to admit that I was quite disappointed that my implementation of traits got so few feedback. That is not the personal disappointment that comes simply for the reason that one wants to share a project and cannot as it does not interest others, that is a risk to take of course ;). It surprised me though that Rubiests that I learnt to like and respect, like e.g. you Dave, still use the terms "types" and "classes" as if they were not in contradiction to what they are saying about duck typing afterwards. With traits we are exactly talking ducktyping, we combine behavior, which we try organize intelligently and forget about inheritance and is_a? modeling. It really gives us the chance to implement applications without abusing of inheritance. The beauty of Ruby is of course that single inheritance and Mixins are still available for projects where this is appropriate, and there are many. The bold statement I will make now is the following: Whenever a projects seems best suited to use ducktyping as its dominant design scheme, traits (as e.g. in Squeak) or prototypes ( as e.g. in Javascript) somehow seem a more natural approach than classes and mixins. Now using mixins extensively (pun intended) is a good thing especially if we refrain from abusing is_a?, Module#=== ed altri. It can lead to beautiful designs(1), but so can using traits and prototypes ;) (1) beware of the double inclusion trap though Cheers Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein