13

Python added the async/await constructs in 3.5 in 2015. The Javascript community made steps towards it for a bazzillion years and finally added a very similar implementation to the draft in ES8 released in 2017 (From my understanding). Typescript also added async methods in 2015 in version 1.7 that to the untrained eye look exactly like js async methods.

C# Added async methods in 2012 that look like all other implementations of async/await and were based on F#'s similarly behaving but different looking asynchronous workflows that were introduced in F# 2.0 in 2010. This is the earliest example I know of language built in asynchronous programming - C# with the async/await pair and F# with async flows.

Are there earlier examples of the keywords being used in this context as language constructs (or library)? From my limited information it looks like everyone imitated the good parts of the C# implementation, but did C# copy it from someone else?

  • 3
    If you're just looking for the usage of the words async await in a programming language, that's fairly recent. But asynchronous programming of the kind practiced by async await has been around for a long time. – Robert Harvey Aug 27 '18 at 14:53
22

Accoding to an Anders Hejlsberg interview for Channel 9 about Asynchronous Programming async/await in C# takes inspiration on async worflows in F#.

In case you don't know, Anders Hejlsberg is the lead architect of C#, and has also worked in other languages including TypeScript.

According to Don Syme, on his blog, F# async workflows take inspiration from the implementation of asynchronous monad for haskell. In particular Peng Li's paper and Koen Claessen's "A Poor Man's Concurrency Monad" paper.

In case you don't know, Don Syme is the lead architect of F#, among other things.

Koen Claessen's paper is the older implementation of operations with a result and continuations I can find, dating to 1999. It implements concurrency by defining atomic operations, continuations and a round-robin scheduler. The monaid approach would be the motivation for the switch from message passing to awaiting results.

Prior work for concurrency in Haskell use some form of channels or message passing for communication.


Speaking of prior work, I have to mention Concurrent Haskell, to which "A Poor Man's Concurrency Monad" is an alternative...

And the paper "Implicit and Explicit Parallel Programming in Haskell" by Mark P. Jones and Paul Hudak. This paper laid the groundwork for Koen Claessen's paper.

In the paper "Implicit and Explicit Parallel Programming in Haskell" Mark and Paul analyze the properties of "fork" and the problem of side effects in concurrency, among other things. They reference the paper "A semantics for ML concurrency primitives" which picks a set concurrent primitives based on Concurrent ML and provides a proof that they preserve sequential execution properties.

  • This is a really good answer. I’m glad you mentioned Haskell & ML (both of which F# draws inspiration from). I know you’ll hear Haskell folks talking about “continuation style”. async/await is just compiler magic/syntax sugar on top of that concept. – RubberDuck Aug 28 '18 at 0:27
0

I believe that Microsoft would not take already existing words, so the words async and await can be attributed to the times which you refer to. However, the ideas of Coroutines and Cooperative multitasking are very old.

  • 2
    I dont think it is correct to compare coroutines and asynchronous programming - they offer very different type of abstraction. – wondra Aug 27 '18 at 13:08
  • 1
    "I believe that Microsoft would not take already existing words" - Do you have any basis for that belief? Designers of successful languages are usually more pragmatic than that. – Sebastian Redl May 4 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.