Live data from Hacker News

ClojureScript Gets Async/Await

clojurescript.org

61–70 of 76 posts

Re: ClojureScript Gets Async/Await

#61
post #58

I noticed borkdude posted this thread *and* he is listed as a contributor for this release. For the longest time, I recall the opposition to async/await support being twofold: 1. adding support would require deep changes across the CLJS compiler (theller, creator of shadow-cljs, once tried and concluded this) 2. macros from libraries like Promesa provided similar convenience There were some other arguments brought up…

I believe Borkdude showed it was possible by first implementing async/await in Squint, his alternative* implementation of ClojureScript, and then took those learnings to the core CLJS compiler.

Re: ClojureScript Gets Async/Await

#62
post #16
post #12

Nice! Now also get rid of the elephant in the room - "Google Closure Compiler" and then we can really celebrate.

Is that something people want to get rid of? Back when I did some clojurescript people were pretty proud of being able to have it used automatically. What's the plan to get the same benefits? Or is the argument that the benefits aren't significant 15ish years on?

I'm a very happy Google Closure Compiler user, especially with the "advanced optimizations" flag. It does a level of code elimination and variable renaming at a level that no other JavaScript tool even approaches. Excellent software.

I think it gets a bad rap because you need to write your code in a certain way to avoid the optimizations breaking things. But if you're a disciplined developer, you'll reap some large benefits.

Re: ClojureScript Gets Async/Await

#64
post #63

I'm not sure how I feel about this; wasn't part of the point of core.async to push all this stuff into channels? I'm not convinced that having a JS-style async keyword is an upgrade.

This is about using a JS feature without bringing in any additional dependencies like core.async. You don't have to use it and you can still use core.async. This was the most asked for feature in the recent ClojureScript survey.

Re: ClojureScript Gets Async/Await

#65
post #24

Surprised to see Clojure/ClojureScript come up on socials more often all of a sudden. I used it professionally for a few years around ~2012 and like many others moved off JVM and moved into typed [functional] languages. Is the sudden buzz due to agentic coding? Does it rip through code faster with no type checking and fewer invalid syntax errors and reserved keywords to deal with? are we in for a sexp resurgence?

Been coding in lots of languages with agentic coding and it performs much better with typed languages since it basically corrects the agent if it does any hallucination errors. Especially during major refactorings. I have been dealing with large untyped python code bases and it sucks with AI since if it's not covered with tests it's such a teadious job to make sure it did not break anything. The stronger the type sys…

Equating Clojure and Python just because they both dynamically typed is a very shallow comparison. The actual, practical experience is like a day and night. We have projects in Python, Clojure, Java, C# and Golang. Clojure is by far the least problematic to deal with. Even though they have many ugly and non-idiomatic, very old parts.

LLMs, matter of fact do work beautifully with Clojure, specifically because of the "true" REPL. Python doesn't have a comparable REPL - at best, Python's is an interactive shell.

When you give an LLM a closed loop system where it can evaluate code in a live REPL and immediately observe the results, it stops guessing and starts reasoning empirically.

With Clojurescript, you get a REPL connected to a browser - LLM can navigate any element, click buttons, have the entire page context to inspect and alter - all that without any compilation, without even saving and reloading any code anywhere. It seems you have zero idea how amazingly liberating the actual experience that is. And btw, it's the most token efficient language¹.

> ClojureScript is not a major language

a) There's plenty of Clojure code in the wild now and it's been there even before we started training LLMs.

b) The language is very small syntactically - it gives LLMs fewer ways to fantasize some weird constructs.

c) More popular languages have dozens of ways of doing similar things. Clojure's community is smaller and organized, there's less fragmentation - they don't have twenty different routing libraries, each with their own embedded DSL. You'd ask an LLM to get routing done in Python - every time it will give you a different answer, in Clojure - it would just pick something solid, community-approved, battle-tested and unambiguous.

I really wish people speculating about practical experiences in different languages had really used them before dumping their conclusions on HN. Because theory, papers and books are one thing - the practical, years-long venture into a language stack might be completely different experience. You can't be just like: "Haskell is great because it's pure and lazy and has types" and "Clojure is lame because it's dynamically typed" - the field experience would vary for a bunch of different reasons.

Every language has to be evaluated holistically and specifically for each situation. Just because we call them "general-purpose PLs", we shouldn't be generalizing them all the time.

___

¹ https://martinalderson.com/posts/which-programming-languages...

Re: ClojureScript Gets Async/Await

#66
post #63

I'm not sure how I feel about this; wasn't part of the point of core.async to push all this stuff into channels? I'm not convinced that having a JS-style async keyword is an upgrade.

This is about using a JS feature without bringing in any additional dependencies like core.async. You don't have to use it and you can still use core.async. This was the most asked for feature in the recent ClojureScript survey.

Fair, I guess I import core.async into every project implicitly so I forgot that it's a separate dep.

Re: ClojureScript Gets Async/Await

#67
post #4

fun fact: clojurescript had support for asynchronous paradigm through core.async library (CSP style) long before async/await landed in javascript itself. edit: i'm in no way trying to diminish the value of this release, just pointing out how cool it is that you can get new language features before they are available in the host language by just adding a library to your dependencies. clojure is awesome!

True, but there are many reasons to avoid core.async, especially in 2026. It balloons up the Js artifact, has no inherent error model, and transforms into state machine code that's hard to read/debug if something goes wrong. Plus, the `go` macro encourages overly-large functions, because it can't transform code outside its own sexpr. As one Cognitect put it, "core.async is beautiful nonsense".

All async systems have pitfalls, I'd say core.async's are pretty minor compared to most other systems. You're right that `go` can encourage bloated functions and it would be better if it, for example, handled exception propagation (I would guess every serious core.async user has written their own go-but-with-exception-handing macro, it's not hard but it is unfortunate duplication of effort).

(I've never had to think about the state machine code when debugging and I've done a lot of core async debugging. That part really does seem to just work.)

Re: ClojureScript Gets Async/Await

#68
post #22

Earlier quoted context omitted.

Heh, I used to maintain manifold/aleph for a few years after Zach left the Clojure community.

That means we have had various exchanges in the past, but I’m operating under a different username here. I’ve had several PRs accepted into there, I think manifold got a lot of things right, if only it weren’t for Zach leaving the community. Unfortunately I left the community for similar reasons, I have a different vision of how the language should evolve than the people in charge, but wasn’t as vocal about it. I sus…

> Unfortunately I left the community for similar reasons

AFAIK Zach was just offered well-paying job that was mostly about dealing with Scala, it wasn't about "how the language should evolve"...

Re: ClojureScript Gets Async/Await

#69
post #24

Surprised to see Clojure/ClojureScript come up on socials more often all of a sudden. I used it professionally for a few years around ~2012 and like many others moved off JVM and moved into typed [functional] languages. Is the sudden buzz due to agentic coding? Does it rip through code faster with no type checking and fewer invalid syntax errors and reserved keywords to deal with? are we in for a sexp resurgence?

[flagged]

Re: ClojureScript Gets Async/Await

#70
post #6

I wish an alternative to JS for the front end would catch on and be something more than obscure... I'd love to use something like clojurescript, but I struggle to imagine doing so for anything but a personal side project :/ Maybe this is easier to adopt if you're already a clojure shop for the backend?

> I struggle to imagine doing so for anything but a personal side project

Don't imagine. You have any bash scripts your team uses? Rewrite them in Babashka. Start with your own personal scripts first, get a knack for it, feel the benefits (it's not going to be universally better for every case). You have to be very confident about it personally, because people will come for your guidance later.

This is a good strategy for introducing unfamiliar things - pick something less important, rewrite it, let it sit there. If it becomes problematic - easy to revert. If people start liking it, you can add more, and so on.

That's how I sneaked F# in my .net shop years ago - I started writing less important tests in it.

Post reply on HN