<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Thanks, i guess i didn't realize that async/await was in fact conceptually decoupled from the underlying task scheduling and execution mechanism, and that the gist really was in the state machine creation ( reading a bit more about c# implementation helped me understand it as well).</div><div><br></div><div>My question regarding async / await semantic on top of actors was also answered by the elixir Task api, which provides those functions as well, by spawning special child actors.</div><div>Which makes me think that maybe this api could be used as an inspiration for swift, so i'll just put the link here <a href="https://hexdocs.pm/elixir/Task.html">https://hexdocs.pm/elixir/Task.html</a> just in case.</div><div><br></div><div><br>Le 18 sept. 2017 à 18:15, Pierre Habouzit <<a href="mailto:phabouzit@apple.com">phabouzit@apple.com</a>> a écrit :<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div><blockquote type="cite" class=""><div class="">On Sep 18, 2017, at 2:32 AM, Benjamin Garrigues via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: SFMono-Light; font-size: 11px; 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;" class=""><br class="Apple-interchange-newline"><br class="">Le 18 sept. 2017 à 07:59, Pierre Habouzit <<a href="mailto:phabouzit@apple.com" class="">phabouzit@apple.com</a>> a écrit :<br class=""><br class=""></div><blockquote type="cite" style="font-family: SFMono-Light; font-size: 11px; 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;" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 17, 2017, at 5:00 AM, Benjamin G via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I've read Chris Lattner proposal on concurrency, and if i'm correct, the proposal is to start implementing async / await mechanism first, then other more evolved mechanisms (such as actors) on top later.<div class=""><br class=""></div><div class="">My question after reading the many conversations (and confusion) around the execution order of async / await on the mailing list is this : </div><div class="">Isn't the actor model a more "elementary" concurrency model than async / await, and so, from a theoretical point of view, wouldn't it make more sense to implement it first as a layer to build future other concurrency mechanisms on top ?</div><div class=""><br class=""></div><div class="">I'm putting emphasis on the "theoretical" aspect of my question, because i'm 100% certain that if Mr Lattner decided to go this path, it's because it makes more sense from an implementation point of view. </div></div></div></blockquote><br class=""></div><div class="">Actors is a way higher level construct than async/await.</div><div class=""><br class=""></div><div class="">async/await is IMO an interesting low level construct that explains to the language where your execution flow requires to be broken in two (what is syntactically before and after the "await") to wait for some event before the second half can be done.</div><div class=""><br class=""></div><div class="">Unlike Actors, it doesn't try to explain what/how/... this is done, which makes it lower level.</div></div></blockquote><div style="font-family: SFMono-Light; font-size: 11px; 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;" class=""><br class=""></div><div style="font-family: SFMono-Light; font-size: 11px; 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;" class="">That's also how i first thought about it, but the more i digg the subject ( especially after viewing <a href="https://youtu.be/7erJ1DV_Tlo" class="">https://youtu.be/7erJ1DV_Tlo</a>), the more i understand actors as a fundamental unit of computation (addressable, with a state), and not a whole framework.</div><div style="font-family: SFMono-Light; font-size: 11px; 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;" class=""><br class=""></div><div style="font-family: SFMono-Light; font-size: 11px; 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;" class="">all the questions i see raised with async/await ( queue hoping, timeouts, error handling, ressource allocation, etc) simply aren't there with actors, because imho, the model is conceptually simpler ( and thus a saner basis for building concurrency).</div><div style="font-family: SFMono-Light; font-size: 11px; 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;" class=""><br class=""></div><div style="font-family: SFMono-Light; font-size: 11px; 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;" class="">I started thinking about what, in the "everything's an actor" model, async/await would mean if called from within an actor and it seems like it would mean that once the await call is made, all the messages sent to that actor are blocked until the response from that call is received ( which is dangerous if the message comes from the network, but not that much when running in the same computer). That seemed interesting but i stopped there because i wanted to have the opinion of more qualified people first.</div></div></blockquote><br class=""></div><div>All of this is orthogonal. async/await, is about explaining to the compiler how to split sequential synchronous looking code into an asynchronous state machine.</div><div><br class=""></div><div>Unlike actors that attach rules and semantics to this, async/await is really just about the compiler transform (which is *not* that easy, especially when C stacks happen in the mix).</div><div><br class=""></div><div>-Pierre</div><br class=""></div></blockquote></body></html>