Latest On C# 6 And VB 12
Written by Mike James   
Friday, 03 October 2014

The latest news from the Microsoft compiler team is that, because the performance and quality of Roslyn is more important, it is time to cut new features from the .NET languages.

 

Csharp6

 

The news isn't that bad, however, and it really shouldn't be taken as any hint of failure or backtracking. It is more realistic to trim back on features than produce a release that doesn't quite work.  Mads Torgersen writes:

"As we enter the final stage in our long quest to renew the C# and Visual Basic experience, we’ve had to make some tough decisions around the set of language features that will make it into the next version of the languages. "

and gives the reason:

"The primary goal is to deliver a magnificent first release of the Roslyn value proposition: deep language understanding in the IDE and available to everyone through a robust and comprehensive API. To deliver this well, we need to scale back our appetite for language features a bit." 

The main features that are being cut are;

  • Primary constructors in C#
  • Declaration expressions in C#

The reason for picking on these two features is that support for them in the IDE and downstream of the compiler aren't as complete as for other features.

A primary constructor provides another way to initialize objects and can be replaced by a suitable explicit constructor. If you include something that looks like a constructor as part of the class definition, for example:

public class Point(int x, int y){}

then private members are created for the parameters and automatically assigned when the class is created. 

Declaration expressions are simply the result of being able to declare variables within an expression. For example:

var y= (int x =3) * x;

sets y to 9.  

Although both seem trivial, the compiler team sees them as the start of something more advanced:

"They are also features that we see as the potential beginning of a bigger story further down the line: primary constructors could grow up to become a full-blown record feature, and declaration expressions would form the corner stone of pattern matching and deconstruction facilities. Now, those features will all be considered together for a later release. As a silver lining we then get to design this continuum holistically, rather than in steps that might tie our hands unduly in a later phase. "

On the plus side string interpolation, which wasn't expected to make it into the next version, probably will. String interpolation can be used to incorporate variables into strings:

"Hello \{record.name) how are you to day"

Overall it is good to see both C# and VB .NET being enthusiastically developed. It is a shame that the same thing can't be said for .NET in general - with WPF still looking a bit like a forgotten technology. 

 

Csharp6

 

Banner


Excel Spreadsheet - A Joke?
01/04/2024

No this isn't an April Fool's although in places it seems like one. It's a true account of how Williams Racing has suffered through reliance on an overgrown and outdated Microsoft Excel spreadsheet, l [ ... ]



Women Who Code Closing For Lack of Funding
24/04/2024

Women Who Code the US-based non-profit organization that since its foundation in 2011 has advocated for women and diversity in technology, has announced its imminent closure due to critical funding cu [ ... ]


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Friday, 03 October 2014 )