ClojureScript Gets Async/Await
ClojureScript 1.12.145 ships native async/await support, targeting ECMAScript 2016. The ^:async hint emits JavaScript async functions directly, eliminating third-party dependencies for modern Browser API and popular library interop.
What Matters
-
^:asyncmetadata ondefncauses the ClojureScript compiler to emit a native JavaScriptasync function. -
awaitworks insideletbindings, including nested lets, enabling structured async control flow without special macros. -
^:asyncalso works ondeftestblocks, enabling async test assertions with try/catch. - Async function support topped the most-recent Clojure community survey as the most-wanted ClojureScript JS interop enhancement.
- Contributor credited: Michiel Borkent (known for babashka and related Clojure tooling).
-
ClojureScript previously relied on
core.async(CSP-style channels) for async—a heavier, conceptually distinct model than promise-based async/await.