[ The draft was updated on 22/10/10 and 8/11/10 ]
The F# asynchronous programming model dates to 2007, and was published in product documentation and Expert F#. However, until now we haven’t had a submitted, succinct conference-style description of the core idea of the model: language integrated asynchronous programming. As a result Tomas Petricek, Dmitry Lomov and I have submitted a paper to PADL 2011 (Practical Aspects of Declarative Languages).
We describe the asynchronous programming model in F#, and its applications to reactive, parallel and concurrent programming. The key feature combines a core language with a non-blocking modality to author lightweight asynchronous tasks, where the modality has control flow constructs that are syntactically a superset of the core language and are given an asynchronous semantic interpretation. This allows smooth transitions between synchronous and asynchronous code and eliminates callback-style treatments of inversion of control, without disturbing the foundation of CPU-intensive programming that allows F# to interoperate smoothly and compile efficiently to .NET and native code.
Acknowledgements. We thank Brian McNamara, Nikolaj Bjorner, Niklas Gustafsson, Simon Peyton Jones, Gregory Neverov, Laurent le Brun, Luke Hoban, Jomo Fisher, Tobias Gedell, Mads Torgersen, Anders Hejlsberg, Stephen Toub, Erik Meijer and many others for their help and advice on the design of the F# async model, and LAMP EPFL for a 2006 sabbatical where this work started. We thank all those who have contributed related work that forms the background to this work and trust that we’ve done justice to that.
A paper like this is important for two reasons:
- Learning. The paper can help people learn F# asynchronous programming “from the ground up”
- Science. The idea of language integrated asynchronous programming has potential application in multiple languages. This paper captures the idea in the context of F#, but ideas presented in ML-family languages are usually “crisp” enough that they can be understood and potentially adopted by other languages. In programming languages, the greatest long-term flattery is imitation 🙂
The attached paper is the final version of the . We’d welcome your comments and input on how we might make the paper better, either by comments below, or email to one of the authors, since we may make an extended version. Thanks!
Don, Tomas and Dmitry.
P.S. Tomas and I have another paper at PADL 2011, Tomas will be blogging about that. See you there!