Remix.run Logo
kasajian 3 days ago

Funny. I was just thinking about dismissing Clojure for a project I'm going to work on because I was concerned about it's lack of ability to work with async calls. I'm too used to how async in JavaScript and C#, and I'm not sure I'd want to work in an environment that doesn't have a simple way to structure async calls. It doesn't necessarily have to be async / await. Just some attention to the issue rather than completely ignoring it.

raspasov 3 days ago | parent | next [-]

That has always been one of Clojure's main strengths (async & concurrency). With the new JVM VirtualThreads, things are looking better than ever.

The transition of core.async specifically to VirtualThreads is still WIP as far as I understand, but with minimal tweaks, 90% of the benefits are already there, even with the current latest version.

puredanger 3 days ago | parent [-]

Virtual thread support in core.async is imminent, should land any day now.

raspasov 3 days ago | parent [-]

woot

mechanicum 3 days ago | parent | prev | next [-]

I’m curious what led to that conclusion. As far as I remember, making concurrency easier to manage was always presented as one of Clojure’s primary objectives. It’s fundamental to the design e.g. a major motivation for all core data structures being immutable.

STM, atoms and agents were there from the beginning. I think futures and promises were added in 1.1. core.async is from 2013. Even popular third-party libraries like promesa and manifold are around 10 years old at this point.

I think flow promises to make it easier to orchestrate core.async, specifically, in complex applications, but the essential primitives are far from new and I don’t consider them any harder to use than JavaScript.

didibus 3 days ago | parent | prev | next [-]

Async/await for Clojure: https://github.com/xadecimal/async-style

beders 3 days ago | parent | prev [-]

You can get basically all variations of async coding with Clojure a la carte.