Template interface and class

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu May 31 05:02:47 PDT 2007


"gerleim" <elf_qt at _deletethisifyouarenotaspammer_yahoo.com> wrote in message 
news:f3m346$2t2e$1 at digitalmars.com...
>
> My test and post is coming from my experience with c# where you get error 
> message at compile time, which I think is convenient.

Two things: one, C#'s generics are far less powerful than templates, and 
don't have all the issues that D's templates have.  It's probably much 
easier to detect this at declaration time in C# than in D.  Additionally 
generics are second-class -- the class owns the generic in C#, rather than 
the other way around.

Two, you _will_ get a compile time error message in D -- just as long as you 
instantiate the class template at least once, like C!(int) c;. 




More information about the Digitalmars-d-learn mailing list