Why Templates?

Georg Wrede georg.wrede at nospam.org
Thu Mar 9 03:47:59 PST 2006


Mark T wrote:
> 
> [T]he term "template" was originally associated with patterns,
> 
> "In computer science, generics is a technique that allows one value
> to take different datatypes (so-called polymorphism) as long as
> certain contracts such as subtypes and signature are kept. The
> programming style emphasizing use of this technique is called generic
> programming." en.wikipedia.org/wiki/Template_(programming) [...]"
...
> www.informatics.susx.ac.uk/books/computers-and-thought/gloss/node1.html

Put like that, it becomes obvious how much of the generic stuff can be 
done with Interfaces.

Even with the STL, all the stuff that trickles through "my custom made 
procedures and functions" needs certain properties. C++ did a good job 
of integrating the fundamental data types and structures to this.

With anything that's objects, D can already be very powerful when one 
combines well factored interfaces with a solid set of orthogonal (not 
necessarily member-) functions.

I love D!



More information about the Digitalmars-d mailing list