Clojure is a hosted language, today it can host on top of JVM, JS, BEAM or .NET CLR engine. It also can interop with Python code. Getting it to run on CL runtime was just a matter of time.
Cool, I wanted to use Clojure on the Raspberry Pi, but the startup time is very slow, due more to loading the core Clojure libraries than the JVM.
It makes writing a Clojure web server really impractical on the Pi. I considered using clojurescript for the server, but ended up just going back to node for my project.
Clojure has the advantage of targeting the JVM and Js runtimes. These are two most popular runtimes for writing web apps currently. Clojure can also be easily integrated into existing projects on these platforms.
My only problem with Clojure is the terrible JVM start up time.
While I agree that for typical long running applications like web servers/web applications this isn't really an issue, the problem manifests itself when you want to write small scripts or small command line applications that have similar performance to their Java equivalent.
If you write a CLI app in Java, the application will execute almost instantly as soon as you run it, but with languages like Clojure/Scala you have to wait a long time.
Nice to see, but I'm still sad Clojure is a hosted JVM language. I find it unwieldy for a lot of things where Go, Python and Chicken Scheme shine, and wish someone got ClojureScript to run natively in things like Bun or Deno so I could have one fast, small runtime.
The JVM is an excellent general purpose, multi-threaded runtime, with a large ecosystem of open source libraries, and its well suited to many types of "back-end" workloads, which is why it was the initial target for Clojure back in 2006/2007. Clojure's great interop with its host platform made it easy for people to get up and running while leveraging all the existing Java libraries they were used to.
The JVM is still a great choice for all those reasons, but its a little heavier than Node.js which specializes in IO bound use cases (i.e. the back-end-for-front-ends that sit between the browser and the heavyweight back-end systems). Node.js is also probably better suited for smaller services, lambdas, and other light-weight scenarios (IOT?).
I'm interested in promoting a full-stack approach to ClojureScript because the JavaScript/Node.js ecosystem is everything that the Java ecosystem was 15 years ago. It has lots of developers, lots of libraries, and a "bad" language. And by sticking with Node.js, its one less hurdle for JavaScript developers to clear when learning ClojureScript. They still get to use all the same libraries they did before (via ClojureScript's great interop), and the runtime characteristics they are used to. Plus, if they then decide to start looking at Clojure on the JVM in the future, they will have already learned the language.
If you just hate the JVM, Clojure was designed in such a way that it could be hosted on many VMs which is nice. As others have pointed out, it can run on BEAM VM or even V8 with Clojurescript I believe.
"Clojure would be a nice environment to work with if it wasn't running on JVM. It renders Clojure a resource hog, and the startup time is awful. A big no-no for most of my use cases."
Then don't use it, right? There are plenty of use cases for which Clojure makes sense, and where running on the JVM is a perk.
reply