Clojure is neither compiled nor has its own VM. Instead, it runs on VMs of other languages. In this lesson, we'll learn about official and unofficial ports and support status.
Hosted nature of Clojure#
Languages like C and C++ compile down to object code, whereas languages like Java and .NET run on a virtual machine. Languages like TypeScript transpile to a different language.
Clojure is a language that is designed to be hosted, ie to run on virtual machines of other languages. This allows tapping into existing ecosystems.
Official and community ports#
Clojure - targets JVM
ClojureCLR - targets .NET (CLR)
Clojure produces .jar files and ClojureCLR produces .dll files.
There are other community ports of Clojure for other runtimes. Some notable dialects are:
Babashka - targets Bash
Joker - targets Go
Ferret - targets ISO C++
Clojurerl - targets Erlang VM
A more extensive list of dialects is available at chr15m/awesome-clojure-likes
The unofficial ports usually tend to implement only a subset of the language. Unless stated otherwise, any reference to "Clojure ports" only includes official ports.
Differences in Clojure dialects#
Clojure does a remarkable job of maintaining a uniform core across ports. But some differences show up due to the nature of the host.
Any JVM, Node, or CLR package can be used transparently by Clojure. Clojure data types are just the host's data types, ie in Clojure a string is a
Reader conditionals (or Clojure Common or .cljc)#
Clojure Common is a concept that lets you target multiple Clojure runtimes with the same code. This concept is Clojure's realization of the "Write once, run everywhere" idea. This topic is vast and out of the scope of this course.
You can read more about reader conditionals at the official docs page. We are not going to target multiple runtimes in this course.
We've learned how Clojure runs on different hosts, and the official and the unofficial ports available for use. We also touched on the fact that Clojure data structures are just the host's data structures. We'll soon start getting our hands dirty!