Targeting Clojure & ClojureScript from a Single Codebase

Targeting Clojure & ClojureScript from a Single Codebase

Talk video available @

Clojure and ClojureScript have been cast from the same mold, to the extent that it is possible to write programs (or, parts of programs) that are entirely portable without changes. However, their lineage and target runtimes necessitate some differences, and others arise because of decisions made in ClojureScript informed by the experiences of building and using Clojure for years prior. While relatively minor, these differences can provoke significant pain when building applications targeting both languages / runtimes, including forcing the maintenance of duplicate codebases, and splitting up namespaces and projects to localize language- or runtime-specific code.

cljx will be presented as a solution to this difficulty, an implementation of "feature expressions" similar to that found in other lisps. Many applications and libraries have used cljx over the past year to eliminate duplication in their cross-language codebases without impacting downstream users (they only ever see "regular" Clojure and ClojureScript), and without sacrificing development-time conveniences (e.g. cljx's integration with nREPL allows you to load code into either Clojure or ClojureScript REPLs as-is, with the necessary transformations applied on the fly). Real-world usage of cljx in the community will be exhibited, and its use in Clojure and ClojureScript REPLs will be demonstrated.


Chas Emerick

March 25, 2014