ClojureScript allows to write code using the Clojure language and compile it to Javascript. It was announced by Clojure's creator Rich Hickey (slides of Rich's ClojureScript announcement and the video of the ClojureScript announcement).



ClojureScript is a subset of Clojure, the features and libraries that are currently left out are either simply not finished yet or won't be added as they make no sense on a Javascript VM, eg. the threading support, the Java integration, etc. A list of differences between Clojure and ClojureScript is documented in the ClojureScript Wiki.

The Why of ClojureScript

The rationale for ClojureScript (from the documentation): "Javascript reaches". Javascript VMs are getting faster and are available in a growing number of places. With ClojureScript, Clojure can be used for GUI client programming, including mobile platforms which today come with powerful HTML components and Javascript VMs. Running Clojure requires a Java VM on the client; while Java VMs might be available on desktop OSes, browsers are more ubiquitous and ship with every client-facing OS. The situation is even clearer on mobile platforms - there's is currently no significant mobile platform that ships with a Java VM capable of running Clojure out of the box. Android doesn't ship with a Java VM; it requires all bytecodes to be translated to the bytecode of its Dalvik VM; making Clojure work well on Android is an ongoing effort.



There's another use case for ClojureScript: command line utilities. Java hasn't been popular for command line utilities, particularly ones that are launched frequently, because of the JVM startup time (solutions such as Nailgun have popped up to help with that). As demonstrated by Rich Hickey, a command line utility compiled to Javascript and run with Node.js comes with a significantly lower startup time.



A popular argument for using Javascript on the server is to reuse the same code on the server and the client; particularly interesting for logic like input validation. With ClojureScript it's now possible to do the same: algorithms written in ClojureScript can be compiled to Javascript and run in the browser, but also used in the server-side Clojure codebase, where it'd be compiled to Java bytecodes. It also leaves open the option of completely dropping Java from the server by writing the application in ClojureScript and running the server side on a Javascript stack like Node.js.

The How of ClojureScript