> Am 07.09.2017 um 07:05 schrieb Chris Lattner via swift-evolution 
> <[email protected]>:
> 
> 
> 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. 

Cheers
Marc




_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to