Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When C# compiler is written in C#, will one be able to modify it?

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

like image 795
Joan Venge Avatar asked Jun 12 '09 19:06

Joan Venge


1 Answers

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.

like image 179
Richard Anthony Freeman-Hein Avatar answered Oct 02 '22 14:10

Richard Anthony Freeman-Hein