I am very pleased to report that a vision of the future of C# and Visual Basic was outlined today where they are moving to join F# in offering what I call language-integrated asynchronous programming support. This was outlined today at PDC10 by Anders Hejlsberg, the designer of C# and Technical Fellow at Microsoft, along with follow up videos from key contributors Mads Torgersen, Lucian Wischik and Stephen Toub.
The proposed design of C# and VB asynchronous programming is pleasant and simple, and heavily inspired by the corresponding feature of F#. I have been a long advocate of improving all .NET languages (cooperatively 🙂 ) and the F# team have been at the forefront of the long and difficult road of proving the viability and importance of language-integrated asynchronous programming both in and outside Microsoft – I still remember TechEd Barcelona 2007 where I first talked about the feature and the nerves I had in explaining this to the professional developer audience. It is a great relief to see this journey heading towards the eventual addition of asynchronous programming to C# and VB, and humbling to see the clear and simple ways the C# and VB team have found to disseminate this idea.
Most critically, this development has the potential to push compositional, structured asynchronous programming through the design of the .NET platform itself, something which will greatly benefit all languages and .NET programmers. The critical task for the C# and VB teams has been to refine the basic idea of language-integrated asynchronous programming support to fit closely with .NET tasks (generally a good thing), and to ensure a very good fit with the C# and VB languages and compilation expectations. Hopefully this will also lead to many improvements with debugging and other critical aspects as well.
One topic we’ll be talking about over the next few months is ensuring smooth interoperability between the F# and the C#/VB models. This looks like it will be smooth and simple without losing the essence of what makes F# async programming particularly effective in interactive and functional programming. Interestingly, the C# and VB material tends to emphasize asynchrony in user interface programming, something often under-emphasized in my own F# material, though others such as Tomas Petricek have looked at this closely.
If you are interested in how the two models relate, please read Tomas Petricek’s blog series on this topic. Even if you’re a C# or VB programmer, we’d encourage you to learn both the C#/VB and F# models, how differ, and how they interoperate. In addition, F# asynchronous programming ships today in Visual Studio 2010, and allows you to use asynchronous programming on .NET 2.0, 3.5, 4.0 and Windows Phone 7.
If you’re interested in a more academic perspective, Tomas is also the co-author of the paper The F# Asynchronous Programming Model, a simple summary of F# asynchronous programming, along with Dmitry Lomov. And for a real walk on the async wild-side, try joinads. C# and VB asynchronous programming also rests heavily on .NET 4.0 tasks, themselves based on work by Daan Leijen of Microsoft Research. Microsoft Research are proud to be at the heart of language innovation at Microsoft, from .NET Generics to LINQ to Asynchrony and beyond.