Live data from Hacker News

Ask HN: Is it possible to write a JavaScript runtime with "await by default"?

news.ycombinator.com

1–7 of 7 posts

Ask HN: Is it possible to write a JavaScript runtime with "await by default"?

#1
So that this code: ``` let a = await aFuncThatReturnPromise(); console.log(a) ```

becomes the following and does the same thing: ``` let a = aFuncThatReturnPromise(); console.log(a) ```

For sometimes I do not want wait, use: ``` let a = nowait aFuncThatReturnPromise(); ```

Re: Ask HN: Is it possible to write a JavaScript runtime with "await by default"?

#6

No, that's not possible. Console.log(a) will always run and finish before your async function finishes in the example that you want.

I know it. But I'm asking about possibility of creating a new runtime.

but then console.log(a) is also a promise...you could do this by adding await to all function calls, a kind of parser preprocessor, and then just removing all noawait's