duck!

Walter Bright newshound2 at digitalmars.com
Sat Oct 16 11:54:08 PDT 2010


Michel Fortin wrote:
> On 2010-10-16 14:32:10 -0400, Walter Bright <newshound2 at digitalmars.com> 
> said:
> 
>>> Nobody is going to start using D because it has a function *named* duck.
>>
>> Maybe not, but it will raise awareness that "D has duck typing". 
>> Otherwise, I guarantee you that people will argue that "I need duck 
>> typing, and Z has it and D does not" if it is named adaptTo.
> 
> The problem is that D doesn't have duck-typing. The adapter pattern 
> isn't duck-typing. Duck-typing is when you have an object and can call a 
> 'quack' function on it and if there's no 'quack' function you get a 
> runtime error.

If you make an interface that consists solely of the 'quack' function, then 
duck!quack(object) satisfies the requirement if object has a 'quack' function.

> It's like saying D is a dynamic language, people will know you're 
> bullshitting them.



More information about the Digitalmars-d mailing list