Concurrency: Implement withUnsafe[Throwing]Continuation
github.com
github.com
Which, if you think about it, is not as unusual as it sounds! In JavaScript, for instance, awaiting an object is equivalent to calling .then() on it, passing a closure which, when called, continues the function that awaited. In other words, JavaScript’s await is call/cc. It just uses .then() instead of a direct call, and has some extra complexity in the form of the ‘rejected’ callback. Other than that it’s the same thing.
Edit: Well, except for the part where you can’t call the resume function more than once (I think?). Which is apparently also the case with this Swift version.
See this paper by Oleg Okmij: http://okmij.org/ftp/continuations/against-callcc.html