#1 Enhance the REPL

Yann N. Dauphin

I've been playing with Clojure this past week. The choices you made are really interesting(Immutability, etc). The language is really cool. One thing is off though...

The current Clojure REPL has no history, no tab-completion, and no way of correcting input. This made it unusable for me. I cannot live without those features. Maybe Emacs can fix this... but I don't use emacs.

This patch adds those features to REPL with minimal changes.

It uses the JLine library. JLine provides the basic console handling functions. It was either that or java-readline. java-readline cannot be used because it links against GNU readline - which is under GPL. JLine is under the BSD license. It is 100% Java and doesn't have dependencies. JLine is used by important projects(i.e. JRuby). It was an easy choice.

The patch only defines one new class: LispConsoleReader. Before the patch, the input was read and transformed into intermediate representation at the same time. This made adding more features to input handling very difficult.

The solution I adopted was to separate the two steps. The input is now read all at once by LispConsoleReader. Then that input is fed to LispReader to be transformed into intermediate representation.

There might be some issues remaining.

Can you review my patch and merge it? That would be great.

Best regards,


  • Patch to enhance the repl