222 points · by maastaar · 7y ago · 41 comments
Futures and Promises and core.async don't allow you to totally avoid planning out your project (I've been bitten slightly by core.async's `go` blocks behaving differently than Go's goroutines), but they are a godsend compared to dealing with manual mutexes and semaphores.
I still need to play with manifold; I hear that it helps deal with the IO-heavy stuff that core.async chokes on.
[1] - https://vertx.io/
Since core.async go blocks aren't fully preemptive, long-running things can eat up the whole thread pool. core.async allocates "number of cores + 2" number of "real" threads to do its work.
For example, say I have a program that downloads hundreds of giant files running on an 8-core server. The naive implementation would have a goroutine/go block for each concurrent download. In Go, this would work more or less ok (assuming you have plenty of memory), but in Clojure it would block all the other go blocks after 10 until the download is done.
Normally, it's not an issue, but it's a small gotcha if you're not paying enough attention.
I find this to be amazingly flexible. You are right in saying that it's a gotcha: you do not want to do I/O heavy work in go blocks in general.
It is also worth noting that core.async works just as well in ClojureScript, which when you thing of it is pretty amazing. No threads there, of course.
edit: Oh but there might be no "core.async sleep" in most of clojure libraries like IO/net stuff, which would explain why async go blocks hold the thread more often than they should, whereas Go has "goroutines sleeps" everywhere.
If you can't saturate the link with one file, then you should consider something like bit torrent.
There isn't someone actively trying to enhance it or add more features to it.
So my understanding is only major issues gets addressed.
After a while libraries and tools stabilize and the community just maintains it.
Source: Worked as a consultant almost exclusively in Clojure for the past 10 years.
Far from the truth IME.
Having said that, Clojure is my favorite programming language for writing "business" applications.