From: William Crawford Date: 2006-08-22T23:10:29+09:00 Subject: Re: Strategy pattern / interface design arrangement Oliver Bandel wrote: > A while ago I heard about duck typing. > I didn't have used Ruby at that time.... I started programming Ruby > about three days ago... and now look at this group.... > ...and again find this "duck type". > > The things I read about it ("duck typing") when I first > had contact to this item seem to be very similar to > type polymorphism of functional languages.... look at > OCaml or haskell for example. I haven't seen anyone mention it, and I think it's important to know... The name 'Duck Typing' comes from the saying "if it walks like a duck and quacks like a duck, it must be a duck." (http://peak.telecommunity.com/DevCenter/MonkeyTyping) In short, if a type/class/whatever has all the methods of a duck (that you intend to use), it's a duck and can be used as a duck would be used, regardless of what's actually under the feathers. In other words, TCPSocket doesn't just inherit from Socket, Object, etc... It IS a Socket, it IS an Object, etc. -- Posted via http://www.ruby-forum.com/.