I wish the await syntax was inverted; instead of waiting for an async function, let all async functions await by default. In other words, I wish this worked: let foo = myAsyncFunc() foo.bar() Why? Because that's the common case, and the caller shouldn't care whether the function is async or not. If you have a non-async function that you want to change to be async, or the other way around, then you have to change ever…
At least in the direction non-async -> async, that is clearly a good thing, since you are changing semantics a lot.
This code is always safe:
x = globalObject.a
functionWithoutSideEffects()
gobalObject.a = x + 1
While this is not: x = globalObject.a
await functionWithoutSideEffects()
gobalObject.a = x + 1
> It's way too easy to forget to add "await" to an async call, and doing so leads to failures that can be hard to track down.This a situation that could clearly be improved with better detection of these cases. Or maybe it should be completely illegal to call an async function without a keyword, so you have to do either `await func()` or `promise func()`.