C# 7 - What Would You Put In? |
Written by Mike James | |||
Thursday, 29 January 2015 | |||
Microsoft's conversion to open source is very patchy, and sometimes seems to make little difference to how things work, but when it comes to C# things really do seem to have changed.
The proceedings of a recent meeting on the design of C#7 have been placed on GitHub for all to read and you can make suggestions. It begins: This time we want to increase the openness further:
it also says that Anders Hejlsberg will always have the last word - which as the chief architect of .NET seems entirely reasonable. So what are the possibilities for the new C#? The team identify a number of possible themes:
The biggest of the themes is better data handling and some of the suggestions so far are:
The big single feature here is the idea of pattern matching to allow, among other things, conditional execution based on type: switch (o) { case string s: Console.WriteLine(s); break; case int i: Console.WriteLine($"Number {i}"); break; case Point(int x, int y): Console.WriteLine("({x},{y})"); break; case null: Console.WriteLine("<null>); break } Array slicing - i.e. having dynamic windows onto arrays is also considered, What about the idea of allowing reference locals and returns? This would allow you to say return a reference to a location in an array. Do we want what would be effectively safe pointers in methods and the complications of pointer assignment? Less controversial are readonly parameters and locals - something that other mainstream languages have. Another sensible suggestion, though difficult to implement well, is the idea of allowing a lambda expression to specify the variables it wants captured in the closure similar to the way C++ lambda's work. The final suggestion in the write up is to allow method contracts to become part of the language syntax. The idea goes further however in that the conditions could be compiled into runtime checks as well as just providing metadata for tools. It is good to see C# look so energized after its long sidelining while WinRT and C++ got all the attention. Perhaps Anders Hejlsberg can forget TypeScript and get back to more important matters in the future. If you want C# to keep going down the open source route then contribute! More InformationC# Design Meeting Notes for Jan 21, 2015 Related ArticlesVisual Studio 2015 CTP 5 Released Microsoft Mass Migration To GitHub .NET Core The Details - Is It Enough? C# Gets A New Operator - Safe Navigation RyuJIT - The Next Gen JIT .NET Compiler Microsoft tells C# developers to learn JavaScript!? Microsoft Team Explains Language Stagnation
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
Comments
or email your comment to: comments@i-programmer.info
|
|||
Last Updated ( Thursday, 29 January 2015 ) |