From: Robert Klemme Date: 2010-07-20T14:20:08+09:00 Subject: Re: ruby abstraction On 20.07.2010 06:47, David Masover wrote: > On Sunday, July 18, 2010 08:46:13 am Rick DeNatale wrote: >> On Sun, Jul 18, 2010 at 6:46 AM, James O'Brien wrote: >>> David, >>> >>> many thanks! i found your explanation very useful.. and an article on >>> duck typing is well worth reading e.g >>> http://en.wikipedia.org/wiki/Duck_typing for any other ruby newbies out >>> there! >> >> FWIW, I wrote a paper about role-based 'types' nearly 20 years ago, >> when I was at IBM. I've shared it with a few experienced Rubyists who >> seemed to find a certain resonance with the ideas. Recently Alexander >> Cockburn (of Crystal fame) with whom I have a shared hertitage at IBM >> back then, tells me he still uses the paper when talking to clients >> about dynamic typing. >> >> http://talklikeaduck.denhaven2.com/files/TypesFromTheClientsViewpoint.PDF > > Definitely a resonance. > > If I understand what you're saying, something like Java interfaces were known > and implemented in C++ and Smalltalk, though more by convention. I wonder if > client-side interfaces were ever implemented as anything quite so explicit... There once was the concept of "signature" in g++. Basically you could retrofit any "interface" as a signature to any class (or even type, I don't exactly remember). The concept was pretty cool but at some point they kicked it out. I guess it was too infrequently used and / or caused too much hassle for the compiler implementation. > I wish I'd known about this earlier. In a Java-based freshman data structures > course, a TA asked an interesting question: "What is the purpose of > inheritance?" I answered, "Code re-use." He disagreed, and I'm not entirely > sure, but I think he said, "Types." In Java! Ah, well... OOSC lists several purposes and Betrand Meyer would heavily agree to you that code reuse is a major reason for inheritance ("implementation inheritance"). So he made Eiffel one of the few OO (the only?) languages in which not every inheritance relationship is a "is a" relationship. Quite interesting stuff. I really should read it again - if only time permitted... Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/