<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">Codefined, just out of curiousity, do you have anything to do with <a href="https://github.com/tc39/proposals/pull/41">this proposal that got announced today</a>? Or is it just a coincidence? :)</p>
<div title="MDH:Q29kZWZpbmVkLCBqdXN0IG91dCBvZiBjdXJpb3VzaXR5LCBkbyB5b3UgaGF2ZSBhbnl0aGluZyB0
byBkbyB3aXRoIFt0aGlzIHByb3Bvc2FsIHRoYXQgZ290IGFubm91bmNlZCB0b2RheV0oaHR0cHM6
Ly9naXRodWIuY29tL3RjMzkvcHJvcG9zYWxzL3B1bGwvNDEpPyBPciBpcyBpdCBqdXN0IGEgY29p
bmNpZGVuY2U/IDop" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Feb 26, 2017 at 3:07 PM Dean Tribble <<a href="mailto:tribble@e-dean.com">tribble@e-dean.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg">Should `callee()` be asynchronous here?  To my mind, no, it shouldn't.  Every single line here is synchronous, so the function itself should surely be synchronous.  Shouldn't functions that may not have `await` in them, but instead that are actually asynchronous and hence use the `async return` keyword be the ones we define with `async`?</span></blockquote><div class="gmail_extra gmail_msg"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg"><br class="gmail_msg"></span></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg">In the Javascript (and Midori) model, concurrent execution of multiple activities is achieved by breaking those activities up into coarse-grained, application-defined "turns" (or "jobs") and interleaving those.  An async boundary is where the current turn could end, and the turns for other concurrent activities might run, changing the state before the current activity proceeds.</span></div><div class="gmail_extra gmail_msg"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_extra gmail_msg"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg">Therefore, </span><span style="color:rgb(0,0,0);font-size:13.3333px" class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">callee</font></span><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg"> must be async, because that declares that there could be a turn boundary within it, and thus, the rest of the state of the program could change as a result of the call.  The caller of </span><span style="color:rgb(0,0,0);font-size:13.3333px" class="gmail_msg"><font face="monospace, monospace" class="gmail_msg">callee </font><i style="font-family:arial" class="gmail_msg">must </i><font face="arial" class="gmail_msg">ensure that it's invariants are correct before allowing other code to interleave with it.</font></span></div><div class="gmail_extra gmail_msg"><span style="color:rgb(0,0,0);font-family:arial;font-size:13.3333px" class="gmail_msg"><br class="gmail_msg"></span></div></div>
_______________________________________________<br class="gmail_msg">
es-discuss mailing list<br class="gmail_msg">
<a href="mailto:es-discuss@mozilla.org" class="gmail_msg" target="_blank">es-discuss@mozilla.org</a><br class="gmail_msg">
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" class="gmail_msg" target="_blank">https://mail.mozilla.org/listinfo/es-discuss</a><br class="gmail_msg">
</blockquote></div></div>