Lably
Skip to content

Async/await

Asynchrony and awaiting feature in programming languages

  • 35 min read
  • 4 chapters

Related on Lably

Through Computer programming, Function (computer programming) and Data structure

It is semantically related to the concept of a coroutine and is often implemented using similar techniques, and is primarily intended to provide opportunities for the program to execute other code while waiting for a long-running, asynchronous task to complete, usually represented by promises or similar data structures. The feature is found in C#, C++, Python, F#, Hack, Julia, Dart, Kotlin, Rust, Nim, JavaScript, and Swift.

History

F# added asynchronous workflows with await points in version 2.0 in 2007. This influenced the async/await mechanism added to C#.

Haskell lead developer Simon Marlow created the async package in 2010.

Microsoft first released a version of C# with async/await in the Async CTP (2011). It was later officially released in C# 5 (2012).

Python added support for async/await with version 3.5 in 2015 adding 2 new keywords, async and await.

TypeScript added support for async/await with version 1.7 in 2015.

JavaScript added support for async/await in 2017 as part of ECMAScript 2017 JavaScript edition.

Rust added support for async/await with version 1.39.0 in 2019 using the async keyword and the .await postfix operator, both introduced in the 2018 edition of the language.

C++ added support for async/await with version 20 in 2020 with 3 new keywords co_return, co_await, co_yield.

Swift added support for async/await with version 5.5 in 2021, adding 2 new keywords async and await. This was released alongside a concrete implementation of the Actor model with the actor keyword which uses async/await to mediate access to each actor from outside.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication