ClojureScript Gets Async/Await
ClojureScript's latest release, 1.12.145, finally brings native async/await support, a feature long-desired by its community. By compiling ^:async hinted functions directly to JavaScript async functions, it drastically simplifies interop with modern browser APIs and libraries. This highly anticipated addition streamlines asynchronous programming, making ClojureScript development more efficient and less dependent on external libraries.
The Lowdown
The ClojureScript team has announced release 1.12.145, bringing a significant enhancement to the language: native support for async/await. This update is poised to improve developer experience significantly, particularly for those interacting with modern JavaScript ecosystems.
- ClojureScript now targets ECMAScript 2016, enabling a careful selection of new interop features.
- By tagging a function with
^:async, the ClojureScript compiler will now emit a native JavaScript async function. - The release provides clear examples of how to use
awaitwithin these new async functions and demonstrates their integration into testing frameworks. - This functionality was the most requested enhancement for JavaScript interop in the last Clojure survey.
- It aims to eliminate the need for additional dependencies when dealing with common asynchronous patterns in modern browser APIs and popular JavaScript libraries.
This release marks a substantial step forward for ClojureScript, aligning it more closely with contemporary JavaScript development practices and addressing a major pain point for its users.