The Next Big Language

Jonathan M Davis jmdavisProg at gmx.com
Wed Oct 20 23:46:15 PDT 2010


On Wednesday 20 October 2010 22:47:15 Paulo Pinto wrote:
> Eiffel does have templates, as in generic types.
> 
> Or do you mean the compile time trick that C++ templates allow, thus
> opening the door for
> the meta programming done at compile time?

Templates and generics are two separate - albeit related - things. Templates 
generate code whereas generics allow you to use multiple types with the same 
code (be it by generating code or by actually making them share code). C++ 
templates happen to allow for metaprogramming beyond that, but I don't think 
that that's necessary for a language to be considered to have templates. The key 
thing is that templates _generate_ code whereas generics can simply make 
multiple types use the same code. C++ and D are the only languages that I'm 
aware of which have templates. Other languages with generics generally don't use 
templates to have generics.

- Jonathan M Davis


More information about the Digitalmars-d mailing list