Proto REPL: A new Clojure REPL for the Atom Editor

- jgilman - Element 84

I’d like to introduce a new Clojure REPL, Proto REPL, that I created as a plugin to the Atom editor. Proto REPL lets you develop Clojure applications in Atom using an interactive REPL driven development experience.

Proto REPL

Proto REPL Features

Atom makes it super easy to install new packages. Just run apm install proto-repl after installing the Atom editor to try it out. You’ll need Java (a Clojure dependency) and Leiningen(a Clojure build tool) installed to use it.

Try it out with the Proto REPL Demo project.

Why a new REPL?

The future of software development going to be interactive. You’ll be connected to your running code in a way that makes it easy to understand what’s going on. Clojure gives me an experience like that today. Using a REPL let’s you easily experiment with small bits of code giving you immediate feedback. It makes you incredibly productive.

For various reasons I’ve decided to look for alternatives to my current Clojure development approach. I currently use Sublime Text with Sublime REPL to do Clojure development. Building Proto REPL in the Atom editor allowed me to replicate that experience but offered new capabilities I didn’t have with Sublime Text.

Visualizations in the Mist

The future of interactive development is going to be visual. The REPL of the future will look more like Gorilla REPL, a notebook style REPL, than the terminal style REPLs we use today. Gorilla REPL is an interesting tool in the same vein as Mathematica Notebooks or IPython Notebooks. It gives you a futuristic REPL experience in which the output of a command might produce a number, a table, a bar chart, or even a map of a spatial area.

Gorilla REPL is great for creating documents but as a REPL for normal development it has limited interaction between your editor and the REPL. Gorilla REPL and a REPL in your editor can run on the same JVM and access code in your project but you can’t send code from your editor directly for display in Gorilla REPL. (Unless I missed this capability somehow.) Your editor and the browser window in which Gorilla REPL runs are two separate applications. This limits how close you can get to a single unified experience. Gorilla REPL is a very useful tool but would benefit from tighter editor integration. However, I’m convinced that Gorilla REPL’s approach of visual output in the web browser is the right one.

The Browser is Your Editor

ATOM is a new-ish editor from Github built on top of Chromium, the open source web browser on which Google Chrome is based. To over-simplify things it’s a text editor built on top of a web browser. You can write packages to extend it in JavaScript. You have access to the Chrome Developer Tools so you can set break points or profile your Atom plugin code. Because ATOM is at its heart a web browser that means you can use the combination of HTML/CSS/JavaScript right in your editor for visualizations or displaying whatever you want.

My goal for the initial version of Proto REPL was to provide feature parity with my REPL setup in Sublime Text. It doesn’t take full advantage of the visual capabilities of Atom yet. Proto REPL barely dips its toes in the visualization and interactive capabilities. When you execute a block of Clojure code in Proto REPL the block is highlighted in yellow for a fraction of a second to give you visual feedback of what was executed. This is done by temporarily applying a background color change with CSS. This simple change was something I couldn’t easily do in Sublime Text but was trivial to do in Atom.

I’m planning to start experimenting with capturing output from the REPL and displaying the results visually in ATOM. I’m hoping that a future version of Proto REPL can offer something a bit more visual.

Links