asyncawait - a function declaration keyword to have callers automatically await result

await/async could be a powerful way to get coroutine like functionality from Javascript but while adding async to function/method declarations isn't much of a burden, adding await on every function call makes code so difficult to read that it's effectively unusable to apply throughout a code base without a transpiler. Perhaps this problem could be resolved by adding a new keyword "asyncawait" (or whatever name people would prefer) with the semantics of when it's called, it's treated as if the caller had used an await on the call.

If there's a concern that this limits the ability of the caller to choose when it wants a promise on an asyncawait declared function, then a 2nd keyword on the caller side to sidestep the automatic await and return the promise could be used.

I don't know if this is the best way to solve this problem and would welcome other suggestions that achieved the same goal. Thanks for listening.

When you await a call to an asynchronous operation, you are introducing a concurrency interleave point. One of the characteristics of JavaScript's innate Event Loop Concurrency model is that it is much more robust against a wide variety of common concurrent programming errors, in large part because the interleave points are both less common and explicitly marked. A feature like what you describe would make the interleaving invisible at the call site, which is extremely perilous. If your code has a large number of awaits, that is potentially diagnostic of other structural concurrency problems that are probably better attacked directly.