What's wrong with D's templates?

bearophile bearophileHUGS at lycos.com
Fri Dec 18 16:43:53 PST 2009


Yigal Chripun:

>To bearophile: you're mistaken on all counts -<

Yes, this happens every day here :-)
I am too much ignorant still about computer science to be able to discuss in this newsgroup in a good enough way.


>generics (when properly implemented) will provide the same performance as templates.<

I was talking about a list of current language implementations.


>Also, a VM is completely orthogonal to this. Ada ain't VM based, is it?<

Ada doesn't use the generics how currently C# implement them. Currently C# generics need a VM.


>Macros should be used for meta-programming and generics for type-parameters.<

This can be true, but there's a lot of design to do to implement that well.
In Go there are no generics/templates nor macros. So generics and macros can be added, as you say.
In D2 there are templates and no macros, so in D3 macros may be added but how can you design a D3 language where templates are restricted enough to become generics? Unless D3 breaks a lot of backwards compatibility with D2 you will end in D3 with templates + macros + language conventions that tell to not use templates when macros can be used. Is this good enough?

Bye,
bearophile



More information about the Digitalmars-d mailing list