<div dir="ltr">@Howard,<div><br></div><div>First, you comparison is unfair! You cannot compare on aproach using throws error handle vs another wich ignore the error and get a optional back. The correct code is:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>func updateImage() async {</div></blockquote></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-size:12.8px">let image: </span><span style="font-size:12.8px"> try? </span><span style="font-size:12.8px">async preprocessImage(downloadI</span><span style="font-size:12.8px">mage()) ?? </span><span style="font-size:12.8px">defaultImage</span></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">let text = </span><span style="font-size:12.8px">try? </span><span style="font-size:12.8px">async</span><span style="font-size:12.8px"> translate(downloadText()) ?? </span><span style="font-size:12.8px">defaultText</span></blockquote></blockquote></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote><span style="font-size:12.8px"></span></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">await </span><span style="font-size:12.8px">render(image: image, text: text)</span></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-size:12.8px">}</span></div></blockquote></div></div></blockquote><div><br></div><div>Also, you fail on justify why Future need to return a optional! You are only making Futures looks worse! You are ignoring all non failable  possibilities! Also, doesn&#39;t make any sense to make `render` async because await will not block the thread anyway, and the call side of the updateImage will call await in this function at some point too!</div></div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"> (<span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>) <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> <span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>               <span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="inbox-inbox-pl-c" style="box-sizing:border-box">//</span> #1: Normal function</span>
<span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>   (<span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>) <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">throws</span> <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> <span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>        <span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="inbox-inbox-pl-c" style="box-sizing:border-box">//</span> #2: Throwing function</span>
<span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>   (<span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>) async <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> <span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>         <span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="inbox-inbox-pl-c" style="box-sizing:border-box">//</span> #3: Asynchronous function</span>
<span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>   (<span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>) async <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">throws</span> <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> <span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Int</span>  <span class="inbox-inbox-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="inbox-inbox-pl-c" style="box-sizing:border-box">//</span> #4: Asynchronous function, can also throw.</span></pre></div><div><br><div><br></div><div>This is pretty easy and make much more sense!</div><div><br></div><div><div>Also you are thinking too hard to explain why Futures is great! Ok! We know that! Future could be the next step!</div><div><br></div><div>The question is not if Future is good or not! The question is: Whats the benefice of use Future on top of async/await, instead the oposite! And nothing that you show here prove that!</div></div><div><br></div><div>Also, this is the Fist step, if, only if we implement Future first, we will not get cancelable returns, timeouts, etc... And the big question: How implement a Future class do interop with CGD in a &quot;Swift way&quot;</div><div><br></div><div>How do you create a mask to some Cocoa API witch return:</div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"><span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">func</span> <span class="inbox-inbox-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">processImageData</span>(<span class="inbox-inbox-pl-smi" style="box-sizing:border-box"><span class="inbox-inbox-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">completionHandler</span></span>: (result: Image) <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> <span class="inbox-inbox-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">Void</span>) { <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">...</span> }</pre></div><div><br></div><div>Using this?</div><div><br></div><div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"><span class="inbox-inbox-inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">func</span> <span class="inbox-inbox-inbox-inbox-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">processImageData</span>() -&gt; Future&lt;Image&gt; { <span class="inbox-inbox-inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">...</span> }</pre></div><br class="inbox-inbox-Apple-interchange-newline"></div><div>This doesn&#39;t make any sense! Create another object every time? Now all calls need to be intercept.... And a lot of other problems! Because Future.get() (like you said) will return a optional value, and we also need handle with that on our code.<br></div><div><br></div><div>Translate to this:</div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"><span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">func</span> <span class="inbox-inbox-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">processImageData</span>() async <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-&gt;</span> Image { <span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">...</span> }</pre></div><div><br></div><div>It&#39;s easy to understand, easy to compile only generate the &quot;original&quot; signature, do not evolve any specific mechanism... and... ok. Just look at the proposal, its all there! We need something easy to be translated to a GCD call now, and maybe pthreads or others API in the future!<br></div><div><br></div><div>You are trying to solve one problem, but the role proposal is about another problem!<br></div><div><br></div><div>Everyone can understand the Future type can do more thinks! It&#39;s already on proposal this notion! And we are trying to discuse what is the ground layer to implement Task/Futures and other things in a good way! Also, to solve one problem which we have now!</div><div><br></div><div>A complete concurrence model will arrive at the time!</div><div><br></div><div><br></div><div><br></div><div><div class="gmail_quote"><div dir="ltr">Em ter, 29 de ago de 2017 às 21:43, Howard Lovatt &lt;<a href="mailto:howard.lovatt@gmail.com">howard.lovatt@gmail.com</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">@Vladimir,<div><br></div><div>Default values are a problem for await/async when combined with parallel running because await returns a value and not an optional (unlike future&#39;s get). Below is a more realistic code for parallel running and a default value using async/await:<div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>func updateImage() async {</div></blockquote></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-size:12.8px">let image: Image</span><br></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">async do {</span><span style="font-size:12.8px"> // Runs in parallel (async)</span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">image = try </span><span style="font-size:12.8px">async preprocessImage(downloadI</span><span style="font-size:12.8px">mage())</span></blockquote><span style="font-size:12.8px">} catch {</span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">image = defaultImage</span></blockquote><span style="font-size:12.8px">}</span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">let text: String</span></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote><span style="font-size:12.8px">async do {</span><span style="font-size:12.8px"> // Runs in parallel (async)</span><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">text = try </span><span style="font-size:12.8px">async</span><span style="font-size:12.8px"> translate(downloadText())</span></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote><span style="font-size:12.8px">} catch {</span><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">text = defaultText</span></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">}<br></span></blockquote></blockquote></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">// This line is complicated! We want render not to block (async), but have to await for image and text.<br>// Render does not throw because it always has valid input.<br>// If async were allowed to prevent blocking then await could not </span></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote><span style="font-size:12.8px"></span></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-size:12.8px">async render(image: await image, text: await text)</span></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-size:12.8px">}</span></div></blockquote><br>Which I don&#39;t think reads as well as the Future version:</div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>func updateImage() -&gt; Future&lt;Void&gt; {</div></blockquote></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>return AsynchronousFuture { _ -&gt; Void in</div></blockquote></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">let image =</span><span style="font-size:12.8px"> preprocessImage(downloadI</span><span style="font-size:12.8px">mage()) // Parallel, Futures are queued on creation</span></blockquote></blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">let text</span><span style="font-size:12.8px"> = translate(downloadText()) // Parallel</span><span style="font-size:12.8px">, Futures are queued on creation</span></blockquote></blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">// Does not block (<span style="font-size:12.8px">Futures are queued on creation</span>), but has to wait for its inputs (get).</blockquote></blockquote></div></blockquote></div><div dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">render(image: image.get ?? defaultImage, text: text.get ?? defaultText)</span></blockquote></blockquote></div></blockquote></div><div dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote><span style="font-size:12.8px"></span></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-size:12.8px">}</span></blockquote><span style="font-size:12.8px">}<br></span></blockquote><div><span style="font-size:12.8px"><br></span></div></div><div><span style="font-size:12.8px">In addition the async/await version does not have timeout; unlike the Future version. </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Suppose t</span>hat downloadImage doesn&#39;t fail, it just takes forever to download the image. The Future version will timeout automatically and the default image will be used. With async/await the code for downloadImage and downloadText will have to start timers and throw if the timers timeout. Nothing to do in the Future version, it handles timeout for you.</div><div><br></div><div>Neither or the above versions have cancel or control over the queue they execute on, but both would be much easier to add to the Future version, like timeout is much easier to add, since Futures support cancel and queue control directly.</div></div><div class="gmail_extra"></div><div class="gmail_extra"><br clear="all"><div><div class="m_7039425805837708588gmail_signature" data-smartmail="gmail_signature">  -- Howard.<br></div></div></div><div class="gmail_extra">
<br><div class="gmail_quote">On 30 August 2017 at 02:45, Vladimir.S via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 29.08.2017 19:02, Wallacy via swift-evolution wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
In this example i think we lose clarity, just looking for the code we cant know if this two line will run on parallel or not!<br>
Also, image.get blocks the thread, in this case we need the await anyway! And `async` can throws too... So the error handler can be pretty similar.<br>
<br></span>
let  image=  asyncpreprocessImage(downloadImage()) // These first two lines run in parallel and I can &quot;see&quot; the async keyword.<br>
let  text=  asynctranslate(downloadText())<br>
await render(image: image ?? defaultImage,text: text ?? defaultText) // No blocking!<br>
<br>
</blockquote>
<br>
FWIW: I&#39;m following the whole discussion from the start, and do support the opinion that async/await is much clear solution that proposed Futures, especially for beginners.<br>
We need a low-level building blocks which can be used to implement Futures/Promises in libraries.<br>
Also I really like the idea of &#39;async&#39; on the caller side to have code running in parallel.<br>
<br>
The &#39;async&#39; version of func declaration is clearly saying what type it *want* to return, and &#39;async&#39; modifier just saying *how* it will/can return that type(&#39;Image&#39; in examples). So on both sides, on declaration and on caller side, we are clear what types we are working with.<br>
Future&lt;Type&gt; - is mixing of what is returning and how this will be returned. Code is saying that we preprocessesImage, but actually we have Future&lt;Image&gt; type, no &#39;markers&#39; of asynchronous code.<br>
<br>
Also, I wonder(if I missed that in proposal/discussion, please let me know), if I have async function like<br>
<br>
func foo() async -&gt; Type {}<br>
<br>
, may I want to call it synchronously? If so, what would be a solution here? I can think about something like &#39;sync&#39; modifier on caller side:<br>
let x = sync foo() // calling asynchronous function synchronously<br>
<br>
I believe that is what Future.get is doing, no?<br>
let future =  ...<br>
future.get() // blocks the execution, waits for the result.<br>
<br>
Probably it is reasonable to allow just call foo() to get blocking result, just like any other &#39;simple&#39; blocking funcs that we call, but this can lead to unexpected behavior as user can expect async execution.<br>
<br>
With Futures, it seems like we can&#39;t &quot;just&quot; call such function and need to call .get() later:<br>
let future = someFuncReturnsFuture() // already returns Future&lt;Type&gt; type<br>
<br>
Vladimir.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
<br>
Like i said before! Today&#39;s, the proposal only lack two things over the `Future`....<br>
Parallel computing: Can be implemented by a third party library or a personal one, but i don&#39;t think this is a good approach to the first version.<br>
Coordination: This we can wait! And why? Because coordination, can be made in different ways, maybe is more suitable to a standard library class/function, not a language level resource.<br>
<br>
Also, coordination cant be applied to all variants of the runtimes in the same way! async/await as language level  works just as well with GCD as with pthreads or another API. And coordination is a compromise that we can make after that one.<br>
<br></span><span>
Em ter, 29 de ago de 2017 às 05:23, Howard Lovatt via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; escreveu:<br>
<br>
    @David,<br>
<br>
    Using the `Future` library based on GCD that I have previously posted your<br>
    example would be:<br>
<br></span>
    let  image=  preprocessImage(downloadImage()) // These first two lines run in parallel<br>
    let  text=  translate(downloadText())<br>
    render(image: image.get ?? defaultImage,text: text.get ?? defaultText)<span><br>
<br>
<br>
    The main difference, and I would argue an improvement, is that the `Future`<br>
    version handles errors.<br>
<br>
    So what advantage does async/await have over a `Future` library we can write today?<br>
<br>
<br>
       -- Howard.<br>
<br>
    On 29 August 2017 at 15:28, David Hart via swift-evolution<br></span>
    &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; wrote:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
        On 29 Aug 2017, at 02:22, Xiaodi Wu via swift-evolution<br></span><span>
        &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; wrote:<br>
<br>
        On Mon, Aug 28, 2017 at 16:10 Adam Kemp via swift-evolution<br></span><span>
        &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; wrote:<br>
<br>
            I know what the proposal said. I’m making a case that there is value in<br>
            doing it differently.<br>
<br>
            The composability of futures is valuable. Mixing and matching<br>
            async/await with futures is also valuable. The queue-returning behavior<br>
            that you can get from futures is also valuable, and building<br>
            async/await on top of futures means async/await can get that for free.<br>
<br>
<br>
        Why couldn&#39;t you mix and match async/await and futures and get the<br>
        queue-return behavior of futures if futures are built on top of async/await<br>
        instead off the other way around?<br>
</span></blockquote><span>
<br>
        We could, but the syntax is much worse. Contrast:<br>
<br></span>
        *async/await built on top of Futures*<br>
        *<br>
        *<br>
<br>
        let  image=  preprocessImage(downloadImage())<br>
        let  text=  translate(downloadText())<br>
        awaitrender(image: image,text: text)<br>
<br>
<br>
        *Futures built on top of async/await*<br>
        *<br>
        *<br>
<br>
        let  image=  Future(downloadImage).then({preprocessImage($0) })<br>
        let  text=  Future(downloadText).then({translate($0) })<br>
        awaitrender(image: image.get(),text: text.get())<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
            Maybe you don’t value those things, which is fine. But I do, and maybe<br>
            other people do too. That’s why we’re having a discussion about it.<br>
<br>
            It can also be valuable having a minimal implementation, but we have to<br>
            acknowledge that it comes with a downside as well. The problem with<br>
            doing a minimal implementation is that you can be stuck with the<br>
            consequences for a long time. I want to make sure that we’re not stuck<br>
            with the consequences of a minimal implementation that doesn’t<br>
            adequately address the problems that async/await should be addressing.<br>
            I’d hate for Swift to get an async/await that is so weak that it has to<br>
            be augmented by tedious boilerplate code before it’s useful.<br>
<br>
<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
            On Aug 28, 2017, at 1:54 PM, Wallacy &lt;<a href="mailto:wallacyf@gmail.com" target="_blank">wallacyf@gmail.com</a><br></span><div><div class="m_7039425805837708588h5">
            &lt;mailto:<a href="mailto:wallacyf@gmail.com" target="_blank">wallacyf@gmail.com</a>&gt;&gt; wrote:<br>
<br>
            We don&#39;t need to this now!<br>
<br>
            Again: (Using proposal words)<br>
<br>
            &quot;It is important to understand that this is proposing compiler support<br>
            that is completely concurrency runtime-agnostic. This proposal does<br>
            not include a new runtime model (like &quot;actors&quot;) - it works just as<br>
            well with GCD as with pthreads or another API. Furthermore, unlike<br>
            designs in other languages, it is independent of specific coordination<br>
            mechanisms, such as futures or channels, allowing these to be built as<br>
            library feature&quot;<br>
<br>
            and<br>
<br>
            &quot;This proposal does not formally propose a |Future| type, or any other<br>
            coordination abstractions. There are many rational designs for<br>
            futures, and a lot of experience working with them. On the other hand,<br>
            there are also completely different coordination primitives that can<br>
            be used with this coroutine design, and incorporating them into this<br>
            proposal only makes it larger.&quot;<br>
<br>
            and<br>
<br>
            We focus on task-based concurrency abstractions commonly encountered<br>
            in client and server applications, particularly those that are highly<br>
            event driven (e.g. responding to UI events or requests from clients).<br>
            This does not attempt to be a comprehensive survey of all possible<br>
            options, nor does it attempt to solve all possible problems in the<br>
            space of concurrency. Instead, it outlines a single coherent design<br>
            thread that can be built over the span of years to incrementally drive<br>
            Swift to further greatness.<br>
<br>
            and<br>
<br>
            This proposal has been kept intentionally minimal, but there are many<br>
            possible ways to expand this in the future.<br>
<br>
            ....<br>
<br>
            The point is: No Future type is indeed proposed yet!<br>
<br>
            The proposal try to include de &quot;minimum&quot; required to implement a basic<br>
            async/await to solve the problem created by the GCD! (Pyramid of doom)<br>
<br>
            The question is: How do you do the same using dispatch_async ?<br>
            dispatch_async also does not return nothing to do what you are<br>
            intentend do do!<br>
<br>
            Algo, by Swift 5 manifesto, there&#39;s no compromise to make a &quot;complete&quot;<br>
            concurrency model by this time!<br>
<br>
            My intention is only make parity to dispatch_async, but also make the<br>
            ground free to make more complex implementation like Futures in<br>
            another round on top of this one.<br>
<br>
            This &#39;async T&#39; can be a real type in the future? Maybe will... But<br>
            doesn&#39;t matter now! Now we only need to is some kind of type which<br>
            need to be unwrapped using await before use. Maybe this<br>
            intermediary/virtual type can be a real thing and gain some abilities<br>
            at some point! Maybe a full Future type, why not?<br>
<br>
            Em seg, 28 de ago de 2017 às 17:33, Adam Kemp &lt;<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a><br></div></div>
            &lt;mailto:<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a>&gt;&gt; escreveu:<span><br>
<br>
                How would these anonymous types get composed? If I wanted to<br>
                implement a function that takes a collection of futures and wait<br>
                on it, how would I do that? That is, how would I implement the<br>
                equivalent of C#’s Task.WhenAll and Task.WhenAny methods?<br>
<br>
                More generally, how do you pass one of these typeless futures to<br>
                some other function so that we can do the waiting there?<br>
<br>
<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
                On Aug 28, 2017, at 1:23 PM, Wallacy &lt;<a href="mailto:wallacyf@gmail.com" target="_blank">wallacyf@gmail.com</a><br></span><span>
                &lt;mailto:<a href="mailto:wallacyf@gmail.com" target="_blank">wallacyf@gmail.com</a>&gt;&gt; wrote:<br>
<br>
                And that&#39;s why I (and others) are suggesting:<br>
<br>
                func processImageData1a() async -&gt; Image {<br>
                  let dataResource  = async loadWebResource(&quot;dataprofile.txt&quot;) //<br>
                No future type here... Just another way to call dispatch_async<br>
                under the hood.<br>
                  let imageResource = async loadWebResource(&quot;imagedata.dat&quot;)<br>
                  // ... other stuff can go here to cover load latency...<br>
                  let imageTmp    = await decodeImage(dataResource,<br>
                imageResource) // Compiles force await call here...<br>
                  let imageResult = await dewarpAndCleanupImage(imageTmp)<br>
                  return imageResult<br>
                }<br>
<br>
                And now we gain all advantages of async/await again without to<br>
                handle with one more type.<br>
<br>
                Em seg, 28 de ago de 2017 às 17:07, Adam Kemp via swift-evolution<br></span>
                &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt;<div><div class="m_7039425805837708588h5"><br>
                escreveu:<br>
<br>
                    I think the biggest tradeoff is clearer when you look at the<br>
                    examples from the proposal where futures are built on top of<br>
                    async/await:<br>
<br>
                        func processImageData1a() async -&gt; Image {<br>
                          let dataResource  = Future { await<br>
                        loadWebResource(&quot;dataprofile.txt&quot;) }<br>
                          let imageResource = Future { await<br>
                        loadWebResource(&quot;imagedata.dat&quot;) }<br>
                          // ... other stuff can go here to cover load latency...<br>
                          let imageTmp    = await decodeImage(dataResource.get(),<br>
                        imageResource.get())<br>
                          let imageResult = await dewarpAndCleanupImage(imageTmp)<br>
                          return imageResult<br>
                        }<br>
<br>
<br>
                    With this approach you have to wrap each call site to create<br>
                    a future. Compare to this:<br>
<br>
                        func processImageData1a() -&gt; Future&lt;Image&gt; {<br>
                          let dataResourceFuture  =<br>
                        loadWebResource(&quot;dataprofile.txt”);<br>
                          let imageResourceFuture = loadWebResource(&quot;imagedata.dat”);<br>
                          // ... other stuff can go here to cover load latency...<br>
                          let imageTmp    = await decodeImage(await<br>
                        dataResourceFuture, await imageResourceFuture)<br>
                          let imageResult = await dewarpAndCleanupImage(imageTmp)<br>
                          return imageResult<br>
                        }<br>
<br>
<br>
                    Here, not only are the explicit wrappers gone, but this<br>
                    function itself can be used with either await or as a future.<br>
                    You get both options with one implementation.<br>
<br>
                    As I’ve mentioned before, C#’s implementation is not tied to<br>
                    any one particular futures implementation. The Task type is<br>
                    commonly used, but async/await does not directly depend on<br>
                    Task. Instead it works with any return type that meets<br>
                    certain requirements (detailed here:<br>
                    <a href="https://blogs.msdn.microsoft.com/pfxteam/2011/01/13/await-anything/" rel="noreferrer" target="_blank">https://blogs.msdn.microsoft.com/pfxteam/2011/01/13/await-anything/</a>).<br>
                    Swift could do this using a protocol, which can be<br>
                    retroactively applied using an extension.<br>
<br>
                    Obviously for this to be useful we would need some kind of<br>
                    existing future implementation, but at least we wouldn’t be<br>
                    tied to any particular one. That would mean library<br>
                    maintainers who have already been using their own futures<br>
                    implementations could quickly adopt async/await in their code<br>
                    without having to rewrite their futures library or throw<br>
                    wrappers around every usage of async/await. They could just<br>
                    adopt a protocol (using an extension, even) and get<br>
                    async/await support for free.<br>
<br>
                    The downside is that this feature would be specific to the<br>
                    async/await use case rather than a generic coroutine<br>
                    implementation (i.e., there would have to be a separate<br>
                    compiler transform for yield return). It’s not clear to me<br>
                    why it should be a goal to have just one generic coroutine<br>
                    feature. The real-world usages of async/await and yield<br>
                    return are different enough that I’m not convinced we could<br>
                    have a single compiler feature that meets the needs of both<br>
                    cleanly.<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_7039425805837708588h5">
                    On Aug 27, 2017, at 7:35 PM, Florent Vilmart<br></div></div><span>
                    &lt;<a href="mailto:florent@flovilmart.com" target="_blank">florent@flovilmart.com</a> &lt;mailto:<a href="mailto:florent@flovilmart.com" target="_blank">florent@flovilmart.com</a>&gt;&gt; wrote:<br>
<br>
                    Adam, you’re completely right, languages as c# and JS have<br>
                    been through the path before, (callback, Promises ,<br>
                    async/await) I believe Chris’s goal it to avoid building a<br>
                    promise implementation and go straight to a coroutines<br>
                    model, which is more deeply integrated with the compiler. I<br>
                    don’t see a particular trade off, pursuing that route, and<br>
                    the main benefit is that coroutines can power any<br>
                    asynchronous metaphor (Signals, Streams, Futures, Promises<br>
                    etc...) which is not true of Futures so i would tend to<br>
                    think that for the long run, and to maximize usability,<br>
                    async/await/yield would probably be the way to go.<br>
<br>
                    On Aug 27, 2017, 22:22 -0400, Adam Kemp &lt;<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a><br></span>
                    &lt;mailto:<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a>&gt;&gt;, wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_7039425805837708588h5">
                    As has been explained, futures can be built on top of<br>
                    async/await (or the other way around). You can have the<br>
                    best of both worlds. We are not losing anything by having<br>
                    this feature. It would be a huge improvement to have this<br>
                    as an option.<br>
<br>
                    However, using futures correctly requires more nested<br>
                    closures than you have shown in your examples to avoid<br>
                    blocking any threads. That&#39;s why you&#39;re not seeing the<br>
                    advantage to async/await. You&#39;re comparing examples that<br>
                    have very different behaviors.<br>
<br>
                    That said, I have also expressed my opinion that it is<br>
                    better to build async/await on top of futures rather than<br>
                    the other way around. I believe it is more powerful and<br>
                    cleaner to make async/await work with any arbitrary future<br>
                    type (via a protocol). The alternative (building futures on<br>
                    top of async/await) requires more code when the two are<br>
                    mixed. I very much prefer how it&#39;s done in C#, where you<br>
                    can freely mix the two models without having to resort to<br>
                    ad-hoc wrappers, and you can use async/await with any<br>
                    futures implementation you might already be using.<br>
<br>
                    I really think we should be having more discussion about<br>
                    the tradeoffs between those two approaches, and I&#39;m<br>
                    concerned that some of the opinions about how C# does it<br>
                    are not based on a clear and accurate understanding of how<br>
                    it actually works in that language.<br>
<br>
                    --                     Adam Kemp<br>
<br>
                    On Aug 27, 2017, at 6:02 PM, Howard Lovatt<br></div></div>
                    &lt;<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a> &lt;mailto:<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a>&gt;&gt;<br>
                    wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
                    The async/await is very similar to the proposed Future (as<br>
                    I posed earlier) with regard to completion-handler code,<br>
                    they both re-write the imported completion-handler<br>
                    function using a closure, the relevant sentence from the<br>
                    Async Proposal is:<br>
<br>
                        &quot;Under the hood, the compiler rewrites this code using<br>
                        nested closures ...&quot;<br>
<br>
<br>
                    Unlike the proposed future code the async code is not<br>
                    naturally parallel, in the running example the following<br>
                    lines from the async code are run in series, i.e. await<br>
                    blocks:<br>
<br>
                       let  dataResource=  awaitloadWebResource(&quot;dataprofile.txt&quot;)<br></span>
                       let  imageResource=  awaitloadWebResource(&quot;imagedata.dat&quot;)<span><br>
                    The equivalent lines using the proposed Future:<br>
                       let  dataResource=  loadWebResource(&quot;dataprofile.txt&quot;)<br></span>
                       let  imageResource=  loadWebResource(&quot;imagedata.dat&quot;)<span><br>
                    Run in parallel and therefore are potentially faster<br>
                    assuming that resources, like cores and IO, are available.<br>
<br>
                    Therefore you would be better using a Future than an<br>
                    async, so why provide an async unless you can make a<br>
                    convincing argument that it allows you to write a better<br>
                    future?<br>
<br>
                      -- Howard.<br>
<br>
                    On 28 August 2017 at 09:59, Adam Kemp &lt;<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a><br></span><span>
                    &lt;mailto:<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a>&gt;&gt; wrote:<br>
<br>
                        This example still has nested closures (to create a<br>
                        Future), and still relies on a synchronous get method<br>
                        that will block a thread. Async/await does not require<br>
                        blocking any threads.<br>
<br>
                        I’m definitely a fan of futures, but this example<br>
                        isn’t even a good example of using futures. If you’re<br>
                        using a synchronous get method then you’re not using<br>
                        futures properly. They’re supposed to make it easy to<br>
                        avoid writing blocking code. This example just does<br>
                        the blocking call on some other thread.<br>
<br>
                        Doing it properly would show the benefits of<br>
                        async/await because it would require more nesting and<br>
                        more complex error handling. By simplifying the code<br>
                        you’ve made a comparison between proper asynchronous<br>
                        code (with async/await) and improper asynchronous code<br>
                        (your example).<br>
<br>
                        That tendency to want to just block a thread to make<br>
                        it easier is exactly why async/await is so valuable.<br>
                        You get simple code while still doing it correctly.<br>
<br>
                        --                         Adam Kemp<br>
<br>
                        On Aug 27, 2017, at 4:00 PM, Howard Lovatt via<br>
                        swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></span>
                        &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_7039425805837708588h5">
                        The running example used in the white paper coded<br>
                        using a Future is:<br>
<br>
                        func processImageData1() -&gt; Future&lt;Image&gt; {<br>
                            return AsynchronousFuture { _ -&gt; Image in<br>
                                let dataResource  =<br>
                        loadWebResource(&quot;dataprofile.txt&quot;) // dataResource<br>
                        and imageResource run in parallel.<br>
                                let imageResource =<br>
                        loadWebResource(&quot;imagedata.dat&quot;)<br>
                                let imageTmp      =<br>
                        decodeImage(dataResource.get ?? Resource(path:<br>
                        &quot;Default data resource or prompt user&quot;),<br>
                        imageResource.get ?? Resource(path: &quot;Default image<br>
                        resource or prompt user&quot;))<br>
                                let imageResult   =<br>
                         dewarpAndCleanupImage(imageTmp.get ??<br>
                        Image(dataPath: &quot;Default image or prompt user&quot;,<br>
                        imagePath: &quot;Default image or prompt user&quot;))<br>
                                return imageResult.get ?? Image(dataPath:<br>
                        &quot;Default image or prompt user&quot;, imagePath: &quot;Default<br>
                        image or prompt user&quot;)<br>
                            }<br>
                        }<br>
<br>
                        This also avoids the pyramid of doom; the pyramid is<br>
                        avoided by converting continuation-handlers into<br>
                        either a sync or future, i.e. it is the importer that<br>
                        eliminates the nesting by translating the code<br>
                        automatically.<br>
<br>
                        This example using Future also demonstrates three<br>
                        advantages of Future: they are naturally parallel<br>
                        (dataResource and imageResource lines run in<br>
                        parallel), they timeout automatically (get returns<br>
                        nil if the Future has taken too long), and if there<br>
                        is a failure (for any reason including timeout) it<br>
                        provides a method of either detecting the failure or<br>
                        providing a default (get returns nil on failure).<br>
<br>
                        There are a three of other advantages a Future has<br>
                        that this example doesn’t show: control over which<br>
                        thread the Future runs on, Futures can be cancelled,<br>
                        and debugging information is available.<br>
<br>
                        You could imagine `async` as a syntax sugar for<br>
                        Future, e.g. the above Future example could be:<br>
<br>
                        func processImageData1() async -&gt; Image {<br>
                            let dataResource  =<br>
                        loadWebResource(&quot;dataprofile.txt&quot;) // dataResource<br>
                        and imageResource run in parallel.<br>
                            let imageResource = loadWebResource(&quot;imagedata.dat&quot;)<br>
                            let imageTmp      = decodeImage(dataResource.get<br>
                        ?? Resource(path: &quot;Default data resource or prompt<br>
                        user&quot;), imageResource.get ?? Resource(path: &quot;Default<br>
                        image resource or prompt user&quot;))<br>
                            let imageResult   =<br>
                         dewarpAndCleanupImage(imageTmp.get ??<br>
                        Image(dataPath: &quot;Default image or prompt user&quot;,<br>
                        imagePath: &quot;Default image or prompt user&quot;))<br>
                            return imageResult.get ?? Image(dataPath:<br>
                        &quot;Default image or prompt user&quot;, imagePath: &quot;Default<br>
                        image or prompt user&quot;)<br>
                        }<br>
<br>
                        Since an async is sugar for Future the async runs as<br>
                        soon as it is created (as soon as the underlying<br>
                        Future is created) and get returns an optional (also<br>
                        cancel and status would be still be present). Then if<br>
                        you want control over threads and timeout they could<br>
                        be arguments to async:<br>
<br>
                        func processImageData1() async(queue:<br>
                        DispatchQueue.main, timeout: .seconds(5)) -&gt; Image {<br>
                        ... }<br>
<br>
                        On Sat, 26 Aug 2017 at 11:00 pm, Florent Vilmart<br>
                        &lt;<a href="mailto:florent@flovilmart.com" target="_blank">florent@flovilmart.com</a><br></div></div><span>
                        &lt;mailto:<a href="mailto:florent@flovilmart.com" target="_blank">florent@flovilmart.com</a>&gt;&gt; wrote:<br>
<br>
                            Howard, with async / await, the code is flat and<br>
                            you don’t have to unowned/weak self to prevent<br>
                            hideous cycles in the callbacks.<br>
                            Futures can’t do that<br>
<br>
                            On Aug 26, 2017, 04:37 -0400, Goffredo Marocchi<br>
                            via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></span>
                            &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt;, wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
                            With both he now built in promises in Node8 as<br>
                            well as libraries like Bluebird there was ample<br>
                            time to evaluate them and convert/auto convert<br>
                            at times libraries that loved callback pyramids<br>
                            of doom when the flow grows complex into promise<br>
                            based chains. Converting to Promises seems<br>
                            magical for the simple case, but can quickly<br>
                            descend in hard to follow flows and hard to<br>
                            debug errors when you move to non trivial multi<br>
                            path scenarios. JS is now solving it with their<br>
                            implementation of async/await, but the point is<br>
                            that without the full picture any single<br>
                            solution would break horribly in real life<br>
                            scenarios.<br>
<br>
                            Sent from my iPhone<br>
<br>
                            On 26 Aug 2017, at 06:27, Howard Lovatt via<br>
                            swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></span>
                            &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_7039425805837708588h5">
                            My argument goes like this:<br>
<br>
                              1. You don&#39;t need async/await to write a<br>
                            powerful future type; you can use the<br>
                            underlying threads just as well, i.e. future<br>
                            with async/await is no better than future without.<br>
<br>
                              2. Since future is more powerful, thread<br>
                            control, cancel, and timeout, people should be<br>
                            encouraged to use this; instead because<br>
                            async/await are language features they will be<br>
                            presumed, incorrectly, to be the best way,<br>
                            consequently people will get into trouble with<br>
                            deadlocks because they don&#39;t have control.<br>
<br>
                              3. async/await will require some engineering<br>
                            work and will at best make a mild syntax<br>
                            improvement and at worst lead to deadlocks,<br>
                            therefore they just don&#39;t carry their weight in<br>
                            terms of useful additions to Swift.<br>
<br>
                            Therefore, save some engineering effort and<br>
                            just provide a future library.<br>
<br>
                            To turn the question round another way, in two<br>
                            forms:<br>
<br>
                              1. What can async/wait do that a future can&#39;t?<br>
<br>
                              2. How will future be improved if async/await<br>
                            is added?<br>
<br>
<br>
                              -- Howard.<br>
<br>
                            On 26 August 2017 at 02:23, Joe Groff<br></div></div>
                            &lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a> &lt;mailto:<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt;&gt; wrote:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
                                On Aug 25, 2017, at 12:34 AM, Howard<br>
                                Lovatt &lt;<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a><br></span><span>
                                &lt;mailto:<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a>&gt;&gt; wrote:<br>
<br>
                                In particular a future that is cancellable<br>
                                is more powerful that the proposed<br>
                                async/await.<br>
</span></blockquote><span>
<br>
                                It&#39;s not more powerful; the features are to<br>
                                some degree disjoint. You can build a<br>
                                Future abstraction and then use async/await<br>
                                to sugar code that threads computation<br>
                                through futures. Getting back to Jakob&#39;s<br>
                                example, someone (maybe the Clang importer,<br>
                                maybe Apple&#39;s framework developers in an<br>
                                overlay) will still need to build<br>
                                infrastructure on top of IBActions and<br>
                                other currently ad-hoc signalling<br>
                                mechanisms to integrate them into a more<br>
                                expressive coordination framework.<br>
<br>
                                -Joe<br>
<br>
<br>
                            _______________________________________________<br>
                            swift-evolution mailing list<br>
                            <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></span>
                            &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br>
                            <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></blockquote><span>
<br>
                        --<br>
                        -- Howard.<br>
                        _______________________________________________<br>
                        swift-evolution mailing list<br>
                        <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br></span>
                        &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br>
                        <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote>
<br>
<br>
</blockquote></blockquote></blockquote>
<br>
                    _______________________________________________<br>
                    swift-evolution mailing list<br>
                    <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br>
                    <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
</blockquote>
<br>
</blockquote>
<br>
            _______________________________________________<br>
            swift-evolution mailing list<br>
            <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<span><br>
            <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
        _______________________________________________<br>
        swift-evolution mailing list<br></span>
        <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<br>
        <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote>
<br>
<br>
        _______________________________________________<br>
        swift-evolution mailing list<br>
        <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<span><br>
        <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
<br>
    _______________________________________________<br>
    swift-evolution mailing list<br></span>
    <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;mailto:<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<span><br>
    <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
</span></blockquote><div class="m_7039425805837708588HOEnZb"><div class="m_7039425805837708588h5">
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div></blockquote></div></div></div></div>