Over the years I've been fortunate enough to work on several different projects. F# is ongoing, has several different aspects (FP, OO, async, units-of-measure etc.) and quite high-visiblity, but perhaps the one that was most timely, most foundational, and most wide-reaching was .NET and C# Generics.
Here are some fun photos from the early history of .NET Generics at the Microsoft Cambridge Research Laboratory in Feb. 1999, in St Georges House, Cambridge UK. The photos were our record of a whiteboard discussion between myself, Cedric Fournet, Nick Benton and Simon Peyton Jones (and maybe some others?). We'd already discussed some of the ideas in Redmond, but it's fun to have visuals like this and memories of the early days of the Cambridge lab and the adhoc meetings where we pursued our ideas. Some parts of the .NET generics design that were only implemented much later ("variance flags on type parameters") are listed.
It was an amazing time, to land at Microsoft with such a great group of people, and at the start of such a great platform.
To write a full history of the project would take more time than I have here, though I hope to do it one day. But I do want to say one thing straight: Generics for .NET and C# in their current form almost didn't happen: it was a very close call, and the feature almost didn't make the cut for Whidbey (Visual Studio 2005). Features such as running CLR code on the database were given higher priority.
It was only through the total dedication of Microsoft Research, Cambridge during 1998-2004, to doing a complete, high quality implementation in both the CLR (including NGEN, debugging, JIT, AppDomains, concurrent loading and many other aspects), and the C# compiler, that the project proceeded. Product group resourcing for the feature was low until 2004, and remained sparse, leading to major overload on MSR Cambridge employees, though ultimately the code, designs and specifications were fully transferred into both the CLR and C#. Today, the future of the CLR is firmly in the hands of those in Redmond.
There were some particularly memorable personal moments:
- missing my wife's birthday in order to make a deadline for NGEN support for generics (she is very forgiving, please thank her if you ever meet her);
- the memory of opening AppDomain.h and realizing the critical nature of the interaction that app domains pose to generics
- making the first public presentation of the work at PLDI 2001
- being told by product team members that "generics is for academics only"
- Eric Rudder's email of April 2002, saying "Just to close out on this thread from my mailbox, we will be doing c# generics for Whidbey, and the previous work will be very leveraged, so thank you".... No. thank YOU, Eric 🙂
What would the cost of inaction have been? What would the cost of failure have been? No generics in C# 2.0? No LINQ in C# 3.0? No TPL in C# 4.0? No Async in C# 5.0? No F#? Ultimately, an erasure model of generics would have been adopted, as for Java, since the CLR team would never have pursued a in-the-VM generics design without external help.
The world is as it is today because we act when we have the chance to act, and because we invest in foundations that last the test of time. If you see a chance, take it.
A huge thank you to everyone who was involved in this work (especially, of course, Andrew Kennedy), and it still gives me a warm glow to look at a .NET, Silverlight or Mono exception stack trace and see some generics hidden in there 🙂