How to get started working on Clojure itself

I’m wanting to learn how to work on Clojure itself. I’ve got IntelliJ (without Cursive) set up to work with the java codebase but now I want to know how people work on the Compiler itself. I’m interested to hear experiences and resources about

  • general overview of how the compiler works
  • how to set up workflow to create artifacts and test them
  • how to get a repl running in the Clojure codebase so you can quickly interact
  • how to profile the results of changes

I’m reading lots of tickets in Jira and git commits but its still quite a lot. Just wondering what people here have done to get involved. Thanks.

1 Like

Unfortunately, there are few resources about how the compiler works. I wish it were otherwise (but wishing does not create time to change that). There are a few good intro conference talks about it (, come to mind) and I think some of the tools.analyzer talks and resources are good intros too ( The Clojure compiler is, however, intentionally not very complicated.

Re workflow, there are instructions for build and test in several ways in the readme: (shocking I know :). Just mvn clean install is enough to build a deploy a snapshot version with your local changes that you can use from other projects.

You can use that jar in a repl with just clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-master-SNAPSHOT"}}}'. (Note that right now snapshot deps are only retrieved from Maven daily, so you’ll need to remove from ~/.m2/repository/org/clojure/clojure/… then add -Sforce to force a re-load (this is something I expect to fix in clj soon).)

Another option is to set up a deps.edn right in the clojure project itself (I do this for some stuff) that looks like this:

 {org.clojure/clojure {:mvn/version "1.10.0-alpha7"}
  org.clojure/test.check {:mvn/version "0.9.0"}
  criterium {:mvn/version "0.4.4"}}
 {:dbg {:classpath-overrides {org.clojure/clojure "target/classes"}}}}

Then use clj -A:dbg to run a Clojure repl.

And then another another way to do it is to connect a Clojure repl via an IDE (I do this via Cursive). That’s useful because you can actually walk across both Java and Clojure code.

I typically use Criterium to profile changes with the bench or quick-bench functions.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.