<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 12, 2017, at 1:00 PM, Wallacy <<a href="mailto:wallacyf@gmail.com" class="">wallacyf@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 24px; 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=""><div class="gmail_quote"><div class=""><br class=""></div><div class=""><div class="">So, the problem is a predefined order to evaluate the values, not a "second" await.</div></div></div></div></div></blockquote><div><br class=""></div><div>No, the order of execution is well-defined. The problem isn’t in which order the arguments are executed. The problem is when that evaluation happens with respect to when we return to the run loop. That’s an entirely new problem with async/await. In Swift today it is not possible to write code that returns to the run loop in between evaluation of arguments.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 24px; 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=""><div class="gmail_quote"><div class="">Like you said, the person can write the wrong code ever anyway!</div></div></div></blockquote><div><br class=""></div><div>True. There are many ways to write bugs. The question is whether the language makes those bugs easier to spot or does it obfuscate them? Making await explicit every time makes this bug easier to see. If I were doing a code review I could spot that bug. Without the explicit await it would be much harder to spot by just reading the code. It’s not clear whether it’s even a bug unless you already know that “processImage” is an async function.</div><div><br class=""></div><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 24px; 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=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word; line-break: after-white-space;" class=""><div class=""></div><div class="">This example also shows once again the importance of returning to the right queue. If the “await downloadImage” continues on some other queue then you would be using UIKit on a background thread, which is not allowed. It seems like we’re starting to see some convergence on this idea, which I’m glad to see.</div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The proposal already covered this:</div><div class=""><br class=""></div><div class=""><pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(246, 248, 250); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; color: rgb(36, 41, 46);" class=""> await DispatchQueue.<span class="inbox-inbox-pl-smi" style="box-sizing: border-box;">main</span>.<span class="inbox-inbox-pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">syncCoroutine</span>()</pre></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"></blockquote></div></div></blockquote></div><br class=""><div class="">As I’ve mentioned before, the proposal is a proposal. This is the discussion of the proposal. I think it’s reasonable for us to disagree with the proposal, especially if we can explain why we think it should change.</div><div class=""><br class=""></div><div class="">As someone who has used C#’s async/await feature (for iOS apps, even) I know first-hand how useful this feature can be (as well as its pitfalls). I’m excited about the prospect of using it in Swift. That’s why I want it to be as good as it can be. As proposed I don’t think it is as good as it can be. That’s why I’m participating in this discussion.</div></body></html>