> Am 24.08.2017 um 22:05 schrieb Thomas via swift-evolution
> <swift-evolution@swift.org>:
>
>>
>> Yes, I think it is mandatory that we continue on the callers queue after an
>> `await ` on some actor method.
>>
>> If you `await` on a non-actor-method though, you would have to changes
>> queues manually if needed.
>>
>> Any `actor` should have a `let actorQueue: DispatchQueue` property so that
>> we can call in these cases:
>>
>> ```await actorQueue.asyncCoroutine()``` as mentioned in the manifesto.
>
> 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?
>
> Thomas
>
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.
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 ;-)
Cheers
Marc
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution