我想知道是否可以为了方便而实现一些新功能。
当它出来时,这可能吗?
C# 5.0:编译器即服务:
http://www.matthewlefevre.com/blog/entry.php/c-40-and-c-50/368
最佳答案
Anders Hejlsberg 说:
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
他还在其他地方(在一次 Channel9 采访中)表示,他们正在将 C# 编译器的核心移植到托管代码,以实现这一点。
有一个demo这可从上一个 PDC 获得。 C# 编译器确实是托管代码。
关于c# - 当 C# 编译器是用 C# 编写的时,是否可以修改它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/988623/