Coffeehouse Post

Single Post Permalink

View Thread: Code Name Roslyn
  • User profile image

    There's lots of occasions now where you want to write a program that is customisable by the user (often another developer) in some way. Right now you have some options: Iterate over a data structure at runtime, effectively you are writing an interpreter; generate C# code and call the compiler, then load the assembly (this is more or less what ASP.NET does); Use Reflection.Emit to generate an assembly in memory. The first option is slow (relatively speaking, it might still be adequate), the second option is clunky and the third option is way too much effort to implement for most people as it involves knowing CIL and how to compilers translate high-level constructs into it.

    Compiler-as-a-service lets you generate fast code at runtime without the clunkiness. Useful for web template engines, implementing macro facilities in applications, aspect-oriented programming, ORMs, etc.