Get the latest tech news

The await event horizon in JavaScript


Why async functions in JavaScript are insufficient as a Structured Concurrency primitive

Resource leaks are considered by many to be the most insidious category of bug in software because of the difficulty in tracking them down coupled with the fact that they often lay hidden until the system is under the stress of a heavy workload. What we would like to see in this case is the forcible return of control back to the protect() function, so that it can run its finally block so that the lock is not leaked and the process exits gracefully. Perhaps someday in the distant future, async functions will provide the programmer with a mechanism to escape the await event horizon, but until that time, a structured concurrency model based on async/await will be nothing more than science fiction.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of javascript

javascript

Photo of await event horizon

await event horizon

Related news:

News photo

Poor man's signals – tiny vanilla JavaScript signals implementation

News photo

Python, JavaScript, Java: ZDNet Calculates The Most Popular Programming Languages

News photo

Compilation of JavaScript to WASM, Part 2: Ahead-of-Time vs. JIT