Thursday, December 22, 2011

Project Roslyn

I just had a first peak at Project Roslyn, Microsofts' Compiler As A Service project, that will be included in the second to next installment of the .NET Framework. The next installment is actually going to be all about the new async capabilities, on which I will blog some in the next couple of weeks, since it is quite exciting to work with as well. But Project Roslyn had me startled. I knew Microsoft was working on a CAAS project, but hadn't really seen much demo's or peak previews pop up. Now I have and I must say it looks very promising.

What will Project Roslyn bring to you. First of all, you will get the ability to compile code on the fly. Kind of like how you would take a script file and run it through an interpreter and get extra functionality. This you can now do as well in your statically compiled C# programs. It actually looks a lot like what you can already do with IronRuby or IronPython.

Another thing is that Project Roslyn, besides compiling code on the fly, also gives you the ability to rewrite code. Now, wouldn't that be nice. You can dive right into the syntax tree and do your own thing with it. It gives you the ability to write your own code refactorings  (the ones that ReSharper left out, that is) and make them available in let's say a context menu in Visual Studio. I hope it will also be possible to hook into the actual compile process and add extra stuff to your code there as well. It would give you an alternative to frameworks like PostSharp. I still have to play around with this to see what will be possible.

They also included a C# interactive window with a Read Eval Print Loop. A lot like the F# interactive window. You even get autocompletion and syntax highlighting in it and it tells you when you made mistakes with squiglies under your code.

Project Roslyn is still a work in progress, and not everything is possible, ... yet. I am really looking forward to the metaprogramming capabilities they will be providing. Next thing will be actually playing some with the CTP and hopefully I will be able to post some concrete stuff for this. Next up will also be some new posts about the async possibilities in C# 5.

No comments:

Post a Comment