> -----Original Message----- > From: dblack / superlink.net [mailto:dblack / superlink.net] > Sent: Friday, August 08, 2003 11:00 AM > To: ruby-talk / ruby-lang.org > Subject: Re: Ducktype, right? > > > > > ### in Ruby > > yourRobot.quack if ducktype(yourRobot, duckness) > > duckHerder.buy(myRobot) if ducktype(myRobot, duckness) > > (I'm not sure I'd file the second example under "duck typing" > (since it's argument-checking rather than object capability > checking), but you could probably come up with a method name > that was a superset of both :-) > I guess I'm not sure what duck typing is, then. My example was assuming I was using the original method from my first post. Thus, duckness is a list of ducky methods. My second example was selling myRobot to a duckHerder since, for all intents and purposes, myRobot acts like a duck. The duckHerder would also consider myRobot to be a duck, assuming we agreed on duckness. I thought that was duck-typing. Drew