<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 24.08.2017 um 22:05 schrieb Thomas via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class="Apple-interchange-newline">Yes, I think it is mandatory that we continue on the callers queue after an `await ` on some actor method.</div><div class=""><br class=""></div><div class="">If you `await` on a non-actor-method though, you would have to changes queues manually if needed.</div><div class=""><br class=""></div><div class="">Any `actor` should have a `let actorQueue: DispatchQueue` property so that we can call in these cases:</div><div class=""><br class=""></div><div class="">```await actorQueue.asyncCoroutine()``` as mentioned in the manifesto.</div></div></div></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div class="">Wouldn't that be really confusing though? That awaiting certain methods would bring us back to the actor's queue but awaiting others would require manual queue hopping? What if the compiler was to always generate the 'await actorQueue.asyncCoroutine()' queue hopping code after awaiting on an async/actor method?</div><div class=""><br class=""></div><div class="">Thomas</div></div><br class="Apple-interchange-newline"></div></blockquote></div><br class=""><div class="">I think we are not allowed to implicitly switch back to the actor's queue after awaiting non-actor methods. These might have been auto converted from Continuation-Passing-Style (CPS) to async/await style. With the `mainActor` idea from the manifesto, all existing code will run in some actor, so changing the queue semantics could break existing code.</div><div class=""><br class=""></div><div class="">Actually, I don’t find it confusing: when calling non-actor methods, you have to take care by yourself - as today. Calling actor methods instead, you don’t have to bother about this any longer - this is actually a big incentive to ‚actorify‘ many APIs ;-)</div><div class=""><br class=""></div><div class="">Cheers</div><div class="">Marc</div></body></html>