On Fri, Oct 11, 2019 at 1:15 AM Andrea Giammarchi <andrea.giammar...@gmail.com> wrote: > Again, the `await?` is sugar for the following: > > ```js > const value = await? callback(); > > // as sugar for > let value = callback(); > if ('then' in value) > value = await value; > ```
Okay, so that has the "you can't predict execution order any more" problem. But that's not consistent with what you said in "otherwise schedule a single microtask if none has been scheduled already, or queue this result to the previous scheduled one", which implies a different desugaring: ```js let value = callback(); if('then' in value || thisFunctionHasntAwaitedYet) value = await value; ``` *This* desugaring has a consistent execution order, and still meets your goal of "don't add a bunch of microtask checkpoints for synchronous values". Put another way, this `await?` is equivalent to `await` *if* you're still in the "synchronously execute until you hit the first await" phase of executing an async function; but it's equivalent to your simpler desugaring ("await only if this is a thenable") after that. > but since I've stated already I have no interest anymore in this proposal, we > can also stop explaining to each others things we know already. I'm fine if you want to drop it, but we're not explaining things we already know to each other. At least one of us is confused about what's being proposed. And the altered desugaring I give up above at least has a chance of happening; the only issue might be the observability of how many microtasks get scheduled. If that's not a problem, it might be possible to suggest this as an actual change to how `await` works. ~TJ _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss