We shipped 2.0!
We shipped the .NET Framework 2.0! Okay, I know that I’m not close to the first person to announce this, but I’m still excited. .NET 2.0 is a great platform for dynamic languages like IronPython to build on top of with several great features:
- System.Reflection.Emit.DynamicMethod fills the biggest hole in the CLR for supporting dynamic languages. It allows cheap generation of code on the fly and most importantly the code it generates doesn't need to live for the full life of the application but can be reclaimed when there are no more references. This ability to generate is reclaimable code is one that the JVM has had for a long time at the ClassLoader level and it's vital to effectively building a dynamic language. What I like particularly about DynamicMethods is that it supports generating code on the granularity of a single method and then exposing that with delegates, the CLR's strongly typed managed function pointers.
- Speaking of delegates, 2.0 saw some major improvements to their performance bringing them extremely close to regular method calls in performance. I've found delegates to be very valuable for implementing Python and these performance improvements are the main reason that IronPython is considerably faster on .NET 2.0 than it was on 1.1.
- Finally, generics were added to the CLR in a deep and consistent way. There are lots of interesting arguments pro and con as to whether or not the benefits of generics outweigh the price of their complexity. However, if you are going to add generics to a system it’s vital to do it in a consistent way. The key element for dynamic languages is that generics are not implemented via compile-time tricks of type erasure, but are deeply embedded in the runtime so that System.Reflection and other runtime mechanisms can just do the right thing. This meant that many generic methods just worked automatically in IronPython with proper type checking with no changes and that it only took about a dozen lines of code to completely support instantiating generic types.
Of course, what I’m most excited about with shipping .NET 2.0 is that I now get to focus full time on the future dynamic language story for .NET. In the short-term that will mean a push to resolve the last few design issues before an IronPython-1.0 release. In the longer-term it should mean even more interesting things…