Wouldn't it be possible to implement all of the same semantics in pure Swift using a concurrent dispatch queue and some semaphores? I tried making a generator like the one in Hexagen:<p><a href="https://gist.github.com/Sidnicious/8e57892b14629c5ec740" rel="nofollow">https://gist.github.com/Sidnicious/8e57892b14629c5ec740</a><p>I understand the main benefits of coroutines as:<p>- Cheap creation<p>- Cheap context switching<p>- Predictable context switching<p>…and I don't know the performance characteristics of Grand Central Dispatch. Could someone who's more familiar with GCD explain why using it for this kind of concurrency is an okay/bad idea and how it compares to coroutines?<p>(FWIW I'm a huge fan of hacking async semantics into languages and made a thing like this for C++: <a href="https://github.com/Sidnicious/team" rel="nofollow">https://github.com/Sidnicious/team</a>)