What is CaaS (Compiler As A Service) in regards to the Roslyn project?
How does using the Roslyn feature improve the performance of a C# application over the current C# 4.0 compiler?
What are the known limitations/issues in the Roslyn-CTP?
What is CaaS (Compiler As A Service) in regards to the Roslyn project?
How does using the Roslyn feature improve the performance of a C# application over the current C# 4.0 compiler?
What are the known limitations/issues in the Roslyn-CTP?
What exactly does Compiler as a Service (CaaS) mean in relation to Roslyn? You can watch a video where Anders Hejlsberg explains that (talk about Roslyn starts at 35 minutes in). Basically, the old C# compiler is a "black box": source code comes in, compiled assemblies come out. Roslyn gives you access inside that box. That means you can get syntactic and semantic information about some code, modify it and give it back to the compiler to process it further. You can use that to do code analysis, refactoring, code generation and more.
There is a long list of features that are not implemented in the current CTP on the Roslyn forum.
Regarding performance, I don't think that's among the goals of Roslyn. Besides, the JIT compiler is more important for performance optimizations than the C#/VB compiler. And Roslyn replaces the C#/VB compiler, not th JIT compiler.
Compiler as a service (CaaS) with respect to Roslyn just means the compilation process is broken down into pieces with a public API that lets you examine the syntactic and semantic models built by the compiler during compilation. The Roslyn C# and VB compilers completely replace the existing compilers, so you can continue to use them in the same way you use the compilers today (as separate executables that converts text files into .net assemblies.) You can also use the compilers as a library of APIs that help you build tools that do deeper or different kinds of code analysis.
Roslyn does not give you specific performance advantage over using the existing compilers because when Roslyn releases they will be one and the same. However, it is possible to use roslyn to build specialized code refactorings that improve your source code.
One advantage that Roslyn has is when your application needs a scripting interface. With Roslyn, you can directly compile the script as C# source code with same programming possibilities as the source of the application and directly use it.
I'm excited about Roslyn because it will allow an easier way to implement Aspect Oriented Programming. Using AOP, you can write common "policies" and apply them across your code instead of spreading it across all your code. Using the Roslyn compiler you could weave these policies across your code at compile time, and keep cross-cutting concerns for polluting your business code. If you want some use cases, check out what PostSharp lists as their use cases
© 2022 - 2024 — McMap. All rights reserved.