Linked by Rüdiger Klaehn on Thu 5th Aug 2004 05:00 UTC
.NET (dotGNU too) One of the most awaited features of Microsoft .NET 2.0 is generics. Generics promise to increase type safety, improve performance, reduce code duplication and eliminate unnessecary casts. The most obvious application of generics in the framework class library are the generic collections in the new System.Collections.Generic namespace. Much has been written about those, but they are not the topic of this article.
Permalink for comment
To read all comments associated with this story, please click here.
Re: Credibility destroyed
by Scott S on Thu 5th Aug 2004 19:04 UTC

Stefan: Briefly, templates are a mechanism to allow generic programming. They allow C++ functions and classes to be type-agnostic, and to be so effeciently.

I agree that Java and C# are more "dynamic" than C++, because they both have a run time environment, whereas C++ does not. C++ has different design goals than Java and C#, so I don't consider that a problem.

I wouldn't use Java's generics as a useful standard. As of 1.5, Java's support for templates/generics really only saves some typing. A Java generic always uses Object as the templatized type, and inserts the approrpriate castings so that the code is type safe. And that's the reason why different instantations of a Java generic can be related to each other: they're trivially related because they all use Object. C++ (and C#) generate actual classes with that type explicity in place.