clojurecider

What is the benefit of having a Clojure project before starting the REPL? Why Cider keeps asking and nudging the user about it?


I am using Emacs and every time I start a Clojure REPL with cider-jack-in , the minibuffer echoes the following:

Are you sure you want to run `cider-jack-in' without a Clojure project? (y or n)

I have a prior experience with Common Lisp and Slime. In this other lisp ecosystem, there is not such a thing. You just start Common Lisp without questions asked.

I do not get the purpose of this message from Cider. Probably, because I am missing something.

It is important to highlight that I do know how to create a Clojure project using lein command. I just do not get its relevance.

What am I missing for not using a Clojure project before starting the REPL? Why is it so relevant?

What is the downside of developing a Clojure program with the .clj file, the REPL, doing some interactive programming, and re-compiling things as the program evolves with editions?

Just preventing problems with namespace?

Thanks


Solution

  • The main reason for using a "project", whether it is via a deps.edn file (for Clojure CLI tooling) or a project.clj file (for lein), is to provide the dependencies and hence the CLASSPATH. Since Clojure runs on the JVM, the CLASSPATH has to be set before the Java process is started. As an aside, this is not strictly true, but I'll ignore that complexity for now. The CLASSPATH is used by the JVM to find and then load classes during runtime.

    If you're not using any dependencies then you can probably get away with not using a project.

    I use emacs with cider and the Clojure CLI tooling myself. You might also want to look into the inf-clojure emacs package.