[Mono-list] C#/.NET Generics update and summary

David Jeske jeske@chat.net
Fri, 28 Mar 2003 11:28:17 -0800

Since I'm very interested in C# Generics, in particular it's ability
to improving typing and help close the performance gap with C/C++, I
figured I'd post a summary of recent Generics information for anyone
who is interested:

1) What is C# Generics?

  Generics for C# and .NET is a set of changes to CIL and C# which
  implement parametric types. Conceptually C# Generics fill roughly
  similar needs as C++ templates or Generic Java (GJC). Currently the
  performance of collections in .NET (or JVM) is similar to that of
  Python, Perl, or Smalltalk because collections involve runtime
  dynamic type casting. Generics for .NET support runtime
  specialization into static code, eliminating the extra typechecks,
  and bringing the performance of collections closer to that of C/C++.


2) What implementation work has taken place with C# Generics?
   Microsoft Research has released an implementation known as Gyro in
   the form of patches to be applied to the Microsoft Shared Source


   Some preliminary work has been done in Portable.NET to support
   Generic C#/CIL. (it dosn't work yet)


   Microsoft has submitted preliminary documents to the ECMA which
   have not yet been released.

3) When will Microsoft release Generics?

   Microsoft announced at OOPSLA 2002 their intent to provide several
   new C# language features including Generics, anonymous methods,
   iterators, and partial types. This provided much confusion as some
   thought that this meant the .NET v1.1 or VS.NET 2003 releases would
   contain Generics. This is not the case.


   Generics is slated for .NET v2.0, known as "Whidbey", with the
   VS.NET for "Yukon". The word is late 2003 or early 2004.

4) When will C# Generics be standardized?

   There are no official dates, however, in an interview last week
   (March 21,2003) Anders confirmed that this work is already

      "In fact, we have already submitted specifications for Generics,
      Iterators, and Partial Classes to ECMA, and we're on schedule to
      submit the remaining specifications within the next several
      months. We remain very committed to C# standardization."


5) How is C# Generics different from Generic Java?

   Generic Java has been in process for a few years. The first
   research implementations existed before C# was release. Sun has
   released a reference compiler (GJC) which implements the JCP
   elected standard. Generic Java does not change the JVM, and thus it
   does not close the performance gap with C/C++. However, it has the
   benefit that it provides the additional typesafety in a very
   backward compatible manner. Existing compiled libraries can be
   "retrofit" with parametric type-specifications. Generic Java is
   rumored to be slated for the next Java release (1.5?) for which no
   date is set.


   C# Generics is similar to Generic Java in many respects. However,
   CIL v2.0 includes specific support for Generics which closes the
   performance gap with C/C++ by specializing code and eliminating
   run-time casts. Gyro, a reference implementation of Generic C#/CIL,
   is available as a patch to the Microsoft Shared Source CLI.


6) Where can I find more information?

    "Future Directions for Visual C#"

    "Interview with Anders Hejlsberg"

    "New C# Language Features"

    "Gates Offers Glimpse of VS Update, Everett"

    "ECMA C# and Common Language Infrastructure Standards"

David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net