From: dblack@... Date: 2006-07-26T23:57:32+09:00 Subject: Re: I'll have the duck! Hi -- On Wed, 26 Jul 2006, Dumaiu wrote: > ara.t.howard@noaa.gov wrote: >> >> i was thinking about this on my ride home and recalled a term used in damian >> conway's object oriented perl book (a fastastic book on oo programming btw.) >> and a term he used way back then : 'interface polymorphism.' the more i >> thought about it the more i like the term better than 'duck typing' because >> it's closer in spirit to the idea of something being an acceptable object >> merely by implimenting (via method_missing or whatever) a certain set of >> behvaiours. >> > > Holy cow; the whole thread was worth it just for this. This is on > target: in ruby-talk 03608 matz in fact mentions as an illustration of > 'implementation polymorphism' the Enumerable module, because the use of > each() is the only requirement defined for compatibility. I will posit > as a distinction that 'duck typing,' as we call it, is a description of > an innate behavior of the language, while 'implementation inheritance' (Do you mean 'interface polymorphism'?) > would be D. Conway's name for the general consequence of building > projects with this kind of model in mind. Don't forget, though, that duck typing was originally intended as a description of something that a programmer does. I've also always tended to see it as a property of the language (i.e., Ruby as a "duck-typed" language, as Jim Weirich has said) -- since the method-call is always isolated from any ancestry checks and so forth that surround it -- but, as I understand Dave's take on it, it does refer at least equally to a programming attitude/style/philosophy (or whatever the best term is). David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy http://www.manning.com/black => RUBY FOR RAILS (reviewed on Slashdot, 7/12/2006!) http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log dblack@wobblini.net => me