duck!

Michel Fortin michel.fortin at michelf.com
Sat Oct 16 13:30:57 PDT 2010


On 2010-10-16 16:05:52 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> On 10/16/2010 02:54 PM, kenji hara wrote:
>> Adapter-Pattern! I'd have forgotten the name.
>> It is NOT equals to duck-typing.
> 
> It's a subset of duck typing. I don't think calling a function that 
> supports a limited form of duck typing "duck" is a lie.

Not a lie, just a word with a deceptive meaning that'll lead people to 
believe something else than the truth. Some cynically call that 
marketing speech.

In my opinion, a duck type in D should be a variant that allows you to 
call all the functions of the underlying object, and throws (at 
runtime) when no matching function is found. I think you'll agree with 
me that this is very far from the adapter pattern.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list