duck!

bearophile bearophileHUGS at lycos.com
Sun Oct 17 19:25:07 PDT 2010


I was busy, so just two comments about this long thread.

Walter Bright:

> A lot of people do think duck typing is very important.

But it's better to add features to D because they are useful for D programs, and not because lot of people want "duck typing" in general.

C#4 has added the "dynamic" keyword, its not named WizBang!, and its semantics is powerful and very well integrated with the rest of the language and virtual machine. This is how C# is better than D both in nomenclature style and in substance:
http://msdn.microsoft.com/en-us/library/dd264736.aspx

If you want you may use Google to find other better pages about the "dynamic" of C#4.

-----------------------

Andrej Mitrovic

> What's all this arguing about anyway?
> 
> import std.conv : duck;
> 
> alias duck as;
> alias duck adaptTo;
> 
> Done deal.

That's false/misleading. I've once renamed "writeln" as "putr" in one of my code snippets and Walter answered me he didn't know what "putr" means despite the first line in the 10-lines long program was the
import std.stdio: putr = writeln;

"alias" is useful, but it's also misleading. Usually if you want your code to be easy to understand you have to stick with the default names that everyone else uses.

Something partially related, about abuse of typedef in Linux kernel:
http://lkml.indiana.edu/hypermail/linux/kernel/0206.1/0402.html

Bye,
bearophile


More information about the Digitalmars-d mailing list