<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="">On Aug 24, 2017, at 3:59 PM, Adam Kemp <<a href="mailto:adam.kemp@apple.com" class="">adam.kemp@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I generally agree that async/await could be more valuable built on top of library support. I did have one nitpick about this:<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Aug 24, 2017, at 1:59 PM, Dave DeLong via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">In other words:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">async func doSomething() → Value { … }</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">Let value = await doSomething()</span></font></div><div class=""><br class=""></div><div class="">Becomes sugar for this pseudocode:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">func doSomething() → Future<Value> { … }</span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">let value = doSomething().value // or however you “wait” for the value</span></font></div></div></div></blockquote></div><br class=""><div class="">These two examples do fundamentally different things. The await version doesn’t block the thread (it would return to the caller instead of blocking and pick up again later). The .value version would have to block. In C# this is equivalent to using the .Result property of the Task<T> type. However, that is strongly discouraged because it easily leads to deadlocks.</div><div class=""><br class=""></div><div class="">A closer equivalent would be something like this:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">func doSomething() -> Future<Value> { … }</div><div class=""><br class="">doSomething().continueWith { (future: Future<Value>) in</div><div class=""> let value = try? future.value</div><div class="">}</div></blockquote><br class=""><div class="">Now it’s asynchronous either way. The continuation block takes a Future<Value> so that you could do error handling (more complex error handling not shown).</div></div></div></blockquote></div><br class=""><div class="">That’s fine. I assumed it was blocking because it has a very prominent “wait” in the name. 🤷♂️ </div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><blockquote type="cite" class="">I’m admittedly not very familiar with async/await or the actor pattern.</blockquote></blockquote><br class=""></div><div class="">:) </div><div class=""><br class=""></div><div class="">Dave</div></body></html>