Partager via


The C# Compiler in Orcas

I started working on the C# compiler team a little more than a year ago, right around the time that we started development on the Orcas C# compiler.  It's been a great project to work on, and it's good to see folks starting to use the new compiler in the recently released March CTP.  I thought it might be interesting to share some of the background on how we approached the scheduling aspects of the development of the compiler.

We had the great benefit of starting Orcas with a prototype C#3.0 compiler already built and released as part of the LINQ CTPs.  This had allowed us to get great in-depth feedback on the language features early, and has enabled a large community of developers to work with LINQ over the last year and a half.  Although this prototype compiler was great for many projects, there were a number of significant known limitations, which were a result of fundamental implementation decisions, and so the senior developers on the team decided that we would need to implement the C#3.0 language features more-or-less from the ground up to get to a ship-quality implementation.  This process also helped us to clarify the design for many of the features, and to make changes or improvements to the design where necessary.

Here's a quick summary of how we scheduled our work to build the C#3.0 compiler for Orcas. 

Milestone 1

Our first goal was to get the most fundamental new language features implemented, so we could begin building LINQ applications with the Orcas compiler as early as possible.  Many of the features in this first set were also chosen because they were pre-requisites for implementing some of the later language features.  For example, lambdas were important to get in early, because the conversion of lambdas to expression trees depended on this.  Here's what we built first:  

  • Local Variable Type Inference (var)
  • Lambdas
  • Object Initializers
  • Extension Methods (usage)

Milestone 2

For our second milestone, our goal was to replace the C#3.0 prototype compiler that we had shipped with the May 2006 CTP.  When we finished this milestone, we actually moved all of the teams internally who were using C#3.0 over to use the Orcas C# compiler.  This required implementing:

  • Lambdas bound to Expression Trees
  • Extension Methods (definition)
  • Collection Initializers
  • Anonymous Types
  • Query Expressions

Milestone 3

The third milestone was shorter, and our goal for this milestone was to get to a good state for the first Beta.  The results of this milestone are what you'll see in the Orcas February/March CTP and the first Orcas Beta.  We also implemented one of the most requested language features in the history of C# - auto-implemented properties!

  • Auto-Implemented Properties
  • Enhancements to Collection Initializers
  • Non-language features, such as debuggability improvements

Milestone 4

We're now working on the last feature milestone for Orcas.  We're finishing off with one more language feature and a lot of work to improve compiler fundamentals, such as error messages and performance.  Note that this work won't make it into the first Beta:

  • Partial Methods
  • Compiler Error Message Improvements
  • Compiler Performance
  • Compiler Generated IL Performance

Comments

  • Anonymous
    March 18, 2007
    There is a little know feature of C# 3.0 called Partial method that people just find out recently.//Definition...