Monday, May 7, 2007

3rd is the one with the treasure chest

I seem to be on a compiler bent. I just committed the following C# 3.0 features to gmcs:
  • Variable type inference (the "var" keyword)
  • Anonymous types.
  • Implicitly typed arrays.
  • Object initialization.
  • Collection initialization.
They're in SVN right now, so go check 'em out! A word of warning: the new compiler errors associated with these features are not in place yet, so only write perfect code.

This is my first time under the hood of a compiler (other than my brainfuck compiler). It took me a while to get my bearings but once I was acclimated, everything went smooth like bunnies. mcs is great to work on: it is very well designed. The foundation for all of these new features (particularly anonymous types) was already in place, I essentially just handled the new syntax. Thanks goes to Marek Safar for his help.

Of course, all of these features are so much pretext for LINQ. Atsushi Eno is working on LINQ for XML and Antonello Provenzano has begun LINQ for SQL. Most of my hacking time this summer will go toward my Summer of Code project but if I have extra time I will defiantly look to the Olive project's LINQ implementation.