What's wrong with D's templates?
Yigal Chripun
yigal100 at gmail.com
Sat Dec 19 05:47:51 PST 2009
On 19/12/2009 02:43, bearophile wrote:
> 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.
>
didn't mean to sound that harsh. sorry about that.
>
>> 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.
they were implemented for a VM based system but nothing in the *design*
itself inherently requires a VM. You keep talking about implementation
details while I try to discuss the design aspects and trad-offs. It's
obvious that we can't just copy-paste the .NET implementation to D.
>> 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
I don't know about D3, But even now in D2 there is confusion as to what
should be implemented with templates and what with CTFE.
More information about the Digitalmars-d
mailing list