What's wrong with D's templates?

bearophile bearophileHUGS at lycos.com
Fri Dec 18 05:53:33 PST 2009


Yigal Chripun:
> There's a whole range of designs for this and related issues and IMO the 
> C++ design is by far the worst of them all.

My creativity is probably limited, so I think that while C++/D templates have some well known problems, they are better than the strategies used by Java, C#, Ada, Haskell, Object-C, Scala, and Delphi to define generic code. They produce efficient code when you don't have a virtual machine at run time, and allow to write STL-like algorithms. If you need less performance and/or you accept worse algorithms/collections then I agree there are designs simpler to use and cleaner than C++/D templates.
If you are able to design something better I'd like to know about your ideas.

Bye,
bearophile



More information about the Digitalmars-d mailing list