Wednesday, June 18, 2014

Roslyn

Roslyn is a mining town in Washington, State. It was where the TV show "Northern Exposure" was filmed and recently it has been undergoing a rejuvenation as cobwebs are brushed off and trendy condo buildings are put up. Microsoft has decided to name its compiler for C# 6.0 Roslyn. It too has a shaking-off-the-cobwebs feeling and is to be the baseline for supporting modern era C# for hopefully a decade to come. Roslyn is written in managed code (not C++) and contains complete top to bottom rewrites of C# and VB. It is ready for concurrency and massively parallelized. It will come with Visual Studio 14 and C# has become an open source language. I saw an Anthony Green of Microsoft speak on Roslyn on Saturday at the Cowtown Code Camp. He showed us the following neat things coming in C# 6.0:

public class Vector2D(int x, int y)
{
   public int x { get; } = x;
   public int y { get; } = y;

 
 

What is above shows off setting default values for property accessory while this shows a code block which will only be run if a string called foo is not null:

If (foo?.Length > -1)
{

 
 

Wouldn't it do the same thing without the question mark? No, without the question mark a null value would cause the line of code to throw an exception. Anthony cautioned the audience not to run Roslyn on the same PC as another Visual Studio compiler. This could cause havoc. One will get live diagnostics tips as one codes with Roslyn. It all seems pretty cool to me. I enjoyed this talk. Mr. Green was on vacation from his day job in Seattle when he presented. Many thanks to him.

No comments:

Post a Comment