C# Async Functions

I was reviewing the new C# specification and the changes that Async Functions made to my beloved language and saw the below section. The outcome has two impression, First it’s funny! Seeing 5 identical phrase in a series in a programming language expression is strange and funny, admit it. But other than that it is definitely complex. It shows all the grammatical and lexical efforts behind the scene for developing such robust and non-nonsense language. Thank you guys, I love the way C# is growing. Thanks.


The grammar of C# is extended as follows:



asyncopt anonymous-function-signature => anonymous-function-body

asyncopt delegate explicit-anonymous-function-signatureopt block

The async modifier is not allowed on method-declarations where the method-body is a ‘;’.

Note that async is a contextual keyword. In all syntactic contexts other than the ones above it is considered an identifier. Thus, the following is allowed (though strongly discouraged!):

using async = System.Threading.Tasks.Task;

async async async(async async) { }


Toward the Async World

CPUs with multiple cores can run many tasks in parallel. Making the best out of this ability needs more efforts on design side through implementation, test, and profiling which with the introduction of .Net Parallel Extensions we have greater set of tools to starting thinking and living the parallel way.

Visual Studio 2010 also ships with F# as a first class language which should gain more attention in different ways. F# takes your hand and brings you to a very practical functional environment which on top of all of its features adjusts a new way of thinking about programming in particular and software development in general. F# also speaks a new language in parallel programming. Its simple and efficient way of implementing the parallel life helps programmers and system engineers to provide better software faster; maybe it’s unusual to say but programming in F# has a very similar taste of developing the agile way. Everything you build is the result of functions interaction; growing, extending and fixing the software is just doing the same to the functions. Therefore you just need to think about the functions of the system you are trying to build and build the essential functions that make it in whole.

It seems this aspect of F# (parallel abilities) is affecting other parts of the .Net framework. C# and VB are going to support the new async programming constructs built-in and therefore we are going to have a new road ahead in the parallel land. As a system engineer/software developer, people should reconstruct their building blocks inside their software repositories. We all have a huge amount of code here and there with the biggest overhead of taking care of parallelization (if available) which could be done in a more efficient and faster way. Many different parts of the programs could run in parallel now, which we may have been implementing the usual sequential way. If we think about our pockets and we need to compete in the market, I think we all should think again and think parallel.

This Async CTP is in its early stages but I’m sure it will become an uncontrollable giant facing every one of us. Take a look at it.

%d bloggers like this: