[swift-evolution] [Concurrency] Fixing race conditions in async/await example

Adam Kemp adam.kemp at apple.com
Tue Sep 12 14:18:11 CDT 2017


> On Sep 11, 2017, at 9:56 PM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
> 
> My hope would be for something along these lines:
> 
> func createDownloadTasks(for urls: [URL]) -> [async Data] {
>    return urls.map { url in async downloadResource(url) }
> }
> func await(all tasks: [async Data]) async -> [Data] {
>    return tasks.map { task in await task }
> }

So that’s basically a new type with a special syntax. What is the advantage to doing it that way versus just introducing a new protocol?


More information about the swift-evolution mailing list