[swift-evolution] [Concurrency] async/await + actors

Marc Schlichte marc.schlichte at googlemail.com
Mon Sep 11 18:19:49 CDT 2017

> Am 07.09.2017 um 07:05 schrieb Chris Lattner via swift-evolution <swift-evolution at swift.org>:
> Imagine you are maintaining a large codebase, and you come across this (intentionally abstract) code:
> 	foo()
> 	await bar()
> 	baz()
> Regardless of what is the most useful, I’d argue that it is only natural to expect baz() to run on the same queue/thread/execution-context as foo and bar. 

But what if `bar` was defined like this in a pre async/await world:

`bar(queue: DispatchQueue, continuation: (value: Value?, error: Error?) -> Void)`

^ There are several existing APIs which use this pattern of explicitly providing the queue on which the continuation should run.

My expectation (especially as a maintainer) would be that the async/await version exhibits the same queueing semantics as the `old` CPS style - whatever that was (implicitly on the main-queue, implicitly on some background queue or explicitly on a provided queue).

Also, a related question I have: Will / should it be possible to mix-and-match CPS and async/await style for system APIs? I would say yes, so that we can transfer to the new async/await style at our own pace. 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170912/ee1d1532/attachment.html>

More information about the swift-evolution mailing list