Hosted Nature

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 targeting the JVM, JavaScript, and .NET are supported officially by the creators of Clojure. The names and targets of these ports are:

  • Clojure - targets JVM

  • ClojureCLR - targets .NET (CLR)

  • ClojureScript - targets JavaScript

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.

ClojureScript is slightly different from Clojure and ClojureCLR, in the sense that it transpiles to JavaScript, whereas the other two produce bytecode. Although the JavaScript code produced by ClojureScript is human-readable, it's not common practice to modify this code manually.

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.

For example, ClojureScript (JS port) is single-threaded because JavaScript is single-threaded. Apart from language-level differences, Clojure dialects are mostly consistent across all runtimes.

Transparent interoperability#

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 java.lang.String whereas in ClojureScript a string is a JavaScript String.

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!

Start a new discussion. All notification go to the author.