Why Templates?

Mark T Mark_member at pathlink.com
Wed Mar 8 06:03:17 PST 2006


In article <dufcpn$p1n$2 at digitaldaemon.com>, Walter Bright says...
>
>
>Technically, Java and C# implement generics, not templates. C++ and D 
>implement templates, not generics.
>
>What's the difference? One way to think about it is generics are handled at 
>run time (by casting), templates at compile time. 

sorry "generics" is a generic term, let's let not pigeon-hole it, Ada uses the
term and it is compile time  

the 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)

"A generic term is one which picks out a class of individuals, or the prototype
of the individual, rather than the individual itself. For example, in the
sentence `The wolf has disappeared from northern Europe,' we are referring to
the genus rather than to a particular wolf."
www.informatics.susx.ac.uk/books/computers-and-thought/gloss/node1.html





More information about the Digitalmars-d mailing list