<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">Howard, with async / await, the code is flat and you don’t have to unowned/weak self to prevent hideous cycles in the callbacks.<br />
Futures can’t do that</div>
<div name="messageReplySection"><br />
On Aug 26, 2017, 04:37 -0400, Goffredo Marocchi via swift-evolution <swift-evolution@swift.org>, wrote:<br />
<blockquote type="cite">With both he now built in promises in Node8 as well as libraries like Bluebird there was ample time to evaluate them and convert/auto convert at times libraries that loved callback pyramids of doom when the flow grows complex into promise based chains. Converting to Promises seems magical for the simple case, but can quickly descend in hard to follow flows and hard to debug errors when you move to non trivial multi path scenarios. JS is now solving it with their implementation of async/await, but the point is that without the full picture any single solution would break horribly in real life scenarios.<br />
<br />
<div id="AppleMailSignature">Sent from my iPhone</div>
<div><br />
On 26 Aug 2017, at 06:27, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br />
<br /></div>
<blockquote type="cite">
<div>
<div dir="ltr">My argument goes like this:
<div><br />
<div>  1. You don't need async/await to write a powerful future type; you can use the underlying threads just as well, i.e. future with async/await is no better than future without. </div>
<div><br /></div>
<div>  2. Since future is more powerful, thread control, cancel, and timeout, people should be encouraged to use this; instead because async/await are language features they will be presumed, incorrectly, to be the best way, consequently people will get into trouble with deadlocks because they don't have control.</div>
</div>
<div><br /></div>
<div>  3. async/await will require some engineering work and will at best make a mild syntax improvement and at worst lead to deadlocks, therefore they just don't carry their weight in terms of useful additions to Swift.</div>
<div><br /></div>
<div>Therefore, save some engineering effort and just provide a future library.</div>
<div><br /></div>
<div>To turn the question round another way, in two forms:</div>
<div><br /></div>
<div>  1. What can async/wait do that a future can't?</div>
<div><br /></div>
<div>  2. How will future be improved if async/await is added?</div>
<div><br /></div>
</div>
<div class="gmail_extra"><br clear="all" />
<div>
<div class="gmail_signature" data-smartmail="gmail_signature">  -- Howard.<br /></div>
</div>
<br />
<div class="gmail_quote">On 26 August 2017 at 02:23, Joe Groff <span dir="ltr"><<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>></span> wrote:<br />
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div class=""><br />
<div>
<blockquote type="cite">
<div>On Aug 25, 2017, at 12:34 AM, Howard Lovatt <<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a>> wrote:</div>
<br class="m_1547456930512826529Apple-interchange-newline" />
<div><span style="font-family:Helvetica;font-size:12px;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;float:none;display:inline!important"><span class="m_1547456930512826529Apple-converted-space"> </span>In particular a future that is cancellable is more powerful that the proposed async/await.</span></div>
</blockquote>
</div>
<br /></div>
<div>It's not more powerful; the features are to some degree disjoint. You can build a Future abstraction and then use async/await to sugar code that threads computation through futures. Getting back to Jakob's example, someone (maybe the Clang importer, maybe Apple's framework developers in an overlay) will still need to build infrastructure on top of IBActions and other currently ad-hoc signalling mechanisms to integrate them into a more expressive coordination framework.</div>
<div class="HOEnZb"><font color="#888888"></font>
<div><font color="#888888"><br /></font></div>
<div><font color="#888888">-Joe</font></div>
</div>
</div>
</blockquote>
</div>
<br /></div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br />
<span>swift-evolution mailing list</span><br />
<span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br />
<span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br /></div>
</blockquote>
</blockquote>
</div>
</body>
</html>