Home > .NET Framework > CLR Generics – Comparing with other generics implementations

CLR Generics – Comparing with other generics implementations

Java
Java implements generics by type erasures and full code sharing. This means a few things to us as developers.
Runtime type information is lost.
Only reference types can be used as type parameters for generics.
The plus the java implementation brings in is that the generated bytecode can run on Java 1.4 JVM too. No JVM updates are required. The JVM itself is blind to generics. It is only the compiler which has been updated.
 
C++
In C++ generics are implemented using full code specialization during compiler time. This results in code bloat. Also another problem is that mos of the C++ generics implentations do not offer the strong type checking offered by CLR when it comes to calling methods on generic type parameters.
 
C++ generics offers operator support, which is a painful miss in the CLR implementation.
 
Advertisements
Categories: .NET Framework
  1. No comments yet.
  1. November 19, 2010 at 11:00 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: