<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=""><div class="">The compiler could rewrite this:</div><div class=""><br class=""></div><div class="">print(await dataModel.getNumberOfEntries())</div><div class=""><br class=""></div><div class="">actor&nbsp;func&nbsp;getNumberOfEntries()&nbsp;-&gt;&nbsp;Int<div class="">{</div><div class="">&nbsp; &nbsp; return&nbsp;theList.count</div><div class="">}</div></div><div class=""><br class=""></div><div class="">as this:</div><div class=""><br class=""></div><div class="">dataModel.getNumberOfEntries(_internalQueue) { count in</div><div class="">&nbsp; &nbsp; print(count)</div><div class="">}<br class=""><br class="">actor func getNumberOfEntries(queue: DispatchQueue, handler: Int -&gt; Void) -&gt; Void<br class="">{</div><div class="">&nbsp; &nbsp; _internalQueue.async {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; let count = theList.count</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; queue.async {</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; handler(count)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="">&nbsp; &nbsp; }<br class="">}</div><div class=""><br class=""></div><div class="">There is another problem that bothers me, if the function were to await on another actor (and therefore dispatch away from its _internalQueue), how would you guarantee that "only one message is processed by the actor at a time". You would need to somehow prevent the internal queue from processing other messages.</div><div class=""><br class=""></div><div class="">Thomas</div><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Aug 2017, at 17:13, Johannes Weiß via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 13px; 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; float: none; display: inline !important;" class="">GCD doesn't actually allow you to dispatch back to the original queue, so I find it unclear how you'd achieve that. IMHO the main reason is that conceptually at a given time you can be on more than one queue (nested q.sync{}/target queues). So which is 'the' current queue?</span></div></blockquote></div><br class=""></body></html>