Many languages implement coroutines. In addition to the usual suspects like C#, Python and JavaScript, they are available in dozens of languages. Some languages use async/await syntax. Almost all coroutines are built on top of futures/promises. Kotlin implements many patterns in the standard library.
A bit of history: Melvin Conway invented coroutines in 1958. Tony Hoare may be known for introducing the null reference, but he also created quick sort and wrote the paper that inspired Go's goroutines and channels.
Many of the languages share motivations for introducing coroutines. In this talk, we'll go over:
* Goroutines and channels in Go.
* Evolution and generalization of generators/yield in Python.
* Comparison of promises and coroutines in JavaScript.
* Code transformation and optimization in C++.
References
* https://en.wikipedia.org/wiki/Coroutine
* https://en.wikipedia.org/wiki/Tony_Hoare
* https://en.wikipedia.org/wiki/Melvin_Conway
* Melvin E. Conway, Design of a separable transition-diagram compiler, Communications of the ACM, Volume 6 Issue 7, July 1963, Pages 396-408 https://dl.acm.org/citation.cfm?id=366704
* C. A. R. Hoare, Communicating sequential processes, Communications of the ACM, Volume 21 Issue 8, Aug. 1978, Pages 666-677 https://dl.acm.org/citation.cfm?doid=359576.359585
* https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/
* http://www.lua.org/pil/9.1.html
* https://wow.curseforge.com/projects/auctioneer
* http://www.golangpatterns.info/concurrency/coroutines
* https://blog.golang.org/concurrency-is-not-parallelism
* https://tour.golang.org/concurrency/1
* How the heck does async/await work in Python 3.5? Brett Cannon, Feb 11, 2016 https://snarky.ca/how-the-heck-does-async-await-work-in-python-3-5/
* David Beazley, Keynote at PyCon Brasil 2015 (Screencast) https://www.youtube.com/watch?v=lYe8W04ERnY
* 6 Reasons Why JavaScript’s Async/Await Blows Promises Away (Tutorial), Mostafa Gaafar, Senior Software Engineer https://hackernoon.com/6-reasons-why-javascripts-async-await-blows-promises-away-tutorial-c7ec10518dd9
* CppCon 2015: Gor Nishanov “C++ Coroutines - a negative overhead abstraction" https://www.youtube.com/watch?v=_fu0gx-xseY
* CppCon 2016: Gor Nishanov “C++ Coroutines: Under the covers" https://www.youtube.com/watch?v=8C8NnE1Dg4A
* CppCon 2017: Gor Nishanov “Naked coroutines live (with networking)” https://www.youtube.com/watch?v=UL3TtTgt3oU
* CppCon 2017: Toby Allsopp “Coroutines: what can't they do?” https://www.youtube.com/watch?v=mlP1MKP8d_Q
* Coroutine Types (C++), By Titus Winters, https://abseil.io/blog/20180713-coroutine-types
* http://www.llvm.org/docs/Coroutines.html