I am wondering about it in terms of whether one can implement some new functionality for convenience.
Will this be possible, when it's out?
C# 5.0: compiler as a service:
http://www.matthewlefevre.com/blog/entry.php/c-40-and-c-50/368
I am wondering about it in terms of whether one can implement some new functionality for convenience.
Will this be possible, when it's out?
C# 5.0: compiler as a service:
http://www.matthewlefevre.com/blog/entry.php/c-40-and-c-50/368
That really depends on a lot of different things. Including but not limited too ...
Now as to what the answers to these questions are, I have no idea. Nor do I believe there is a stated answer one way or the other to the fundamental question #1. So the overall answer is a big "Don't know"
Yes, the C# version of the compiler would be the "official Microsoft C#", and you could create your "own C# language" with it. Then you could create a compiler written in your "own C# language" to compile itself or other programs
Seriously. NO. This would be a support nightmare for Microsoft. "Bootstrapping" compilers, that is, compilers that compiler the language they are written in have been around (and common) since at least the 70's. That doesn't have anything to do with letting customer change the source cod though, supportability is the entire issue there. So for now, VS-IDE add-ins are about as close as you'll get.
If I understand your question correctly, then I think the answer is a partial yes: building a C# compiler in C# (or actually, in .NET) would make it very easy to expose hooks in the compilation process which users would be able to use from within the language itself.
As an example of a .NET language with a .NET compiler, check out Boo. Since Boo's compiler is written in .NET (mostly in C# and a little Boo, to be precise) it is very easy to hook into the compilation process with things like compilation macros and meta-programming.
I imagine that when the C# compiler is itself written in C#, meta-programming C# would become a lot easier and pretty inevitable. However I doubt Microsoft would make the entire compiler "user-modifiable", since, as stated in other answers, that would mean a support nightmare. Other open source C# compilers exist, however, and might be more liberal in their approach.
Anders Hejlsberg said:
"It is one of the directions we are looking at for future versions of C#. Indeed, I see meta-programming as a piece of our bigger “Compiler as a Service” theme that we are working on for a future release. We want to open up our compiler so it becomes an API you can call to compile a piece of code and get back expression trees and/or IL. This enables a whole host of scenarios, such as application programmability, an interactive prompt, user-written refactorings, and domain specific languages that have little islands of C# imbedded in them." (Source)
He also said elsewhere (in a Channel9 interview) that they were porting the core of the C# compiler to managed code, to enable this.
There is a demo of this available from the last PDC. The C# compiler is indeed managed code.