> -----Original Message----- > From: dblack / superlink.net [mailto:dblack / superlink.net] > Sent: Thursday, August 07, 2003 6:41 PM > To: ruby-talk / ruby-lang.org > Subject: Re: Ducktype, right? > > This is sort of like having a discovered mixin. Neat. > ^^^^^^^^^^^^^^^^^^ > > Intriguing phrase. What do you mean exactly? :-) > From my days as a LISP programmer, we could create objects at will just by mixing in (thus, mixin) named capabilities. This would be done explicitly. Example: ;;;in CLOS/LISP (defclass my-animal-robot (basic-robot house-cleaner-mixin duck-mixin) (... now my robot-duck can clean the house ...)) ;;;; So it's sort of like multiple inheritance, but when I was doing LISP it was much looser than 'inheritance'. You just tossed it in there. But still, it was defined previously. So, to answer your question. I'm just saying it's a neat idea that I could check ANY object to see if (discover) that the object has this capability (kindof like a mixin) solely based on it's operations, as opposed to its having been formally defined that way. ### in Ruby yourRobot.quack if ducktype(yourRobot, duckness) duckHerder.buy(myRobot) if ducktype(myRobot, duckness) ### > > David > Drew