Build: The future of C#

by DotNetNerd 14. May 2018 17:02

Along the same line as the TypeScript talk, Mads Thorgersen and Dustin Campbell did a great talk about the future of C#, opening with some statistics that show how loved and widely used the language really is. Even though I am very much in love with F#, I am also quite happy doing my work in C#, as I have been for 14 years, so it is nice to see innovation in the language continue, and especially that they keep on drawing inspiration from F#.

The first part of the talk covers the 7.1, 7.2 and 7.3 releases, and some of the small but nice changes that came with these releases, like async main methods, Span<T> allowing us to partially specify named arguments and so on.

Moving on from that it gets really interesting, when they showcase a number of prototypes they are working on. One demo shows that it looks like we are finally getting non-nullable reference types as an opt in, as Anders Hejlsberg highlighted way back when I interviewed him at GOTO in 2012.

Next up was some experiments with expression based and recursive pattern matching extending on the switch statement syntax. Really cool stuff, where it will be interesting to see how far they will actually go, when it comes to making an actual release. Richer pattern matching is a feature I miss from F#, so I hope they will take this pretty far.

Syntax for indexing from the end of a stricture was also demoed, with samples of range and slicing syntax that was pretty much directly stolen from Python. This is another one of those features that I miss every time I am manipulating strings or doing complex algorithms over collections.

The last demoes were on async where they are looking into adding a IAsyncDisposable interface, as well as IAsyncEnumerable<T> to allow foreach statements over streams of data. Compared to what other languages do async/await, still feels a bit limited, so I am glad to see more happening here, although to my mind there are more advanced scenarios that I would like to see. Am obvious one being primitives for working with actors, like there is in F# with MailboxProcessors, and in languages like Elixir and Go. Akka.NET does a good job, but it would be nice with some of the primitives being supported in the language.

Lastly Mads and Dustin touched on default interface members, and records. Both are features that have been talked about before, but maybe this time they will go through with them. The issue is that default interface members requires changes to the runtime, which they have avoided doing for a long time, but if sounds like they are opening up to doing it more in the future. Records are probably the one feature along with non-nullable types, that could potentially have the biggest impact in the code we write every day. I would love if they go through with them, because it is one of those basic functional constructs that are missing, and it feels so tedious to manually write classes with immutable properties, equality comparisons, hashcode and deconstructor implementations.

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List