Async / await for Clojure, built on top of core.async

:rocket: Announcing: async-style 0.1.0 :rocket:

JS-style async/await has finally landed in Clojure!

• async/await implementation on top of core.async
• Follows the JavaScript Promise API and semantics as close as possible, so you already know how to use it
• Comes with blocking/await and compute/await as well, for asynchronous blocking and compute tasks
• async/wait for when you need to uncolor your code
• First-class error handling with implicit try/catch/finally and threading friendly helper catch, then , handle, finally, etc.
• First-class cancellation (cancel!, cancelled?)
• Macros for painless flow: ado, alet, clet

Try it: GitHub - xadecimal/async-style: Higher level utilities over Clojure core.async that let you use an async style of programming with ease.

Give it a :star:, start hacking, and let async-powered Clojure code fly! :dizzy:

10 Likes

Question not answered in the readme: what benefits do you see with this programming style compared to the coming structured programming baked in the jvm?
I could already answer to me that it works today without requiring the preview flag. Or its similarity with JS
But I am mostly interested in your opinion

Great work anyway. Waiting for my next home coding session to try it on personal projects

1 Like

I’m not too sure what the structured concurrency of Java will end up looking like, and not sure how ergonomic they will be in Clojure. So I can’t fully compare to that.

For me, I was going with familiarity, if you come from C#, JS, or many other languages, you know this style already, it’s nice to just be able to use what you know as-is. So it was about giving more choice. Clojure already has other styles, raw java concurrency, core.async CSP, future/agent and such, but it was missing this quite common approach.

I also started work on this library quite a few years ago, when Java’s lightweight threads were not even available in preview haha. And then I had kids, so it took a lot longer to be released.

2 Likes

Cool. Thanks

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.