DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Lap Around Roslyn CTP: Introduction

Lap Around Roslyn CTP: Introduction

Allen Coin user avatar by
Allen Coin
·
Jan. 10, 13 · Interview
Like (0)
Save
Tweet
Share
1.73K Views

Join the DZone community and get the full member experience.

Join For Free
The Roslyn project is the Microsoft implementation of C# and VB compilers-as-a-service. Roslyn provides a transparent view into the inner workings of the compiler, including syntax tree inspection and modification.

An initial CTP of Roslyn has been released for download a couple of days ago—it requires Visual Studio 2010 SP1 and the VS2010 SP1 SDK.

Some of the scenarios enabled by Roslyn are the following:

Refactoring. Refactoring tools no longer need to parse the original source code and then reconstruct it manually. Instead, a set of rewriting APIs is available on the syntax tree level, making possible classical refactorings—“make readonly”, “extract method”, “extract interface”—as well as incredible new things yet to be invented.

Code analysis. Performing static code analysis—especially when data flow and control flow are involved—is an extremely difficult task without the syntactic and semantic compiler engines. It becomes possible to answer questions like “is this local variable returned from the method?”, “is this parameter assigned in this specific block under that specific condition?”, “is this method invoked with a compile-time constant expression?”.

“Quick Fix”. Visual Studio extensions that run in the background can detect common source code issues and suggest a fix.

REPL (Read-Eval-Print Loop). To test code quickly against a given API or to invent a new API and then try it out is easier than ever with the C# Interactive Window in Visual Studio. It is more powerful than the Immediate Window, because you can use the full power of the language—including lambdas and query comprehensions—and because you can define new types or methods and immediately use them.

Scripting. Roslyn ships with a command-line tool called rcsi.exe that evaluates .csx files—script files written in C# that are clear of the “class Program … void Main” clutter and focus on exactly the task at hand. I’ll go as far as saying that this is serious competition for PowerShell!

Embedded compiler. It is now easier to embed the C# compiler in an application and provide an ambient context (host object model) implicitly to the compiled code. Think DSLs and rule engines—taking advantages of the full power of C#.

In the next couple of posts we’ll perform some experimentation with the Roslyn APIs. If you are looking for more, right away, then go ahead and read the “Getting Started” documents and the samples that ship with the CTP.

article writing Database Flow (web browser) Tree (data structure) Task (computing) Syntax (programming languages) API application Data (computing)

Published at DZone with permission of Allen Coin. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Using JSON Web Encryption (JWE)
  • Choosing the Best Cloud Provider for Hosting DevOps Tools
  • Memory Debugging: A Deep Level of Insight
  • Why Does DevOps Recommend Shift-Left Testing Principles?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: