duck!

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


Leandro Lucarella wrote:
> Walter and you have the same convoluted brain, I can understand why he
> instantly recognize it ;)



> I already made my point, it make no sense to keep defending my position
> since, evidently, is a pure subjective matter.

It certainly is a glorious bikeshed.

> I just think auto a_bird = duck!Bird(a_duck) is not obvious at all
> compared to auto a_bird = adapt!Bird(a_duck). I even think adaptTo is
> even cleaner, and I tend to hate long names, specially when camelCase is
> involved, but since you didn't like it I, as others, suggested simply
> adapt). If one could write auto a_bird = adapt!a_duck(Bird), adapt would
> be as clear as adaptTo is with the current syntax. With adaptTo!Type you
> even have the precedent of the to!Type template, so it seems like a nice
> extension.

Microsoft has a tradition of naming their products after what they do: Windows, 
Word, Office, etc. It's obvious why they do it, and it works, but it is just so 
generic and dull.

Being the upstart language, D needs now and then something a little more 
attention-getting than generic terms. The "duck" feature is important for two 
reasons:

1. duck typing is all the rage now

2. being able to implement duck typing as a library feature (rather than a 
language one) is a great demonstration of what D can do

Label it "adaptTo" and few will even notice it. Label it "duck" and people will 
click on the link to see what it does. It's important that people notice that D 
has these things, and "duck" helps with that.

I've been in this business a long time, and while you'd think that programmers 
are above "what's in a name", we are just like everyone else. A catchy name gets 
results. Borland, for example, added a trivial and boring feature to their 
linker, called it "smart linking", and managed to get an unbelievable amount of 
hoopla from the computer press out of it. They did it again with another feature 
they called "zoom".

Which blog article would you click on? "Interface Adapter for D" or "Duck Typing 
for D"?

"duck" is a great name for the feature. It's short & sweet, fits right in with 
the popularity of duck typing, stands out, isn't boring, etc. Heck, as proof, 
look at all the interest in this thread!!


More information about the Digitalmars-d mailing list