Lately we are very interested in Lisp and the immense productivity gain when developing with it, and we are especially enthusiastic about Clojure, a new dialect of Lisp. Therefore we thought of trying to write some Wave robots in Clojure.
Some people have already experimented with writing robots in Clojure (for example here and here). However, these approaches still assume that development is done on Google App Engine (GAE). This means that you have to redeploy each time there is a new version of your robot (contrary to the common Lisp way which is just evaluating code into a remote process, known as a REPL). We also wanted to use an in-memory database instead of dealing with database schemas and other irrelevant issues for prototyping. This can’t be done with GAE since each robot event gets sent to a different machine running the robot code and the memory is not shared.
In order to write in Clojure and use an in-memory database, we had to find a way to write our code outside of GAE. Google currently allows robots to only be run on GAE so the solution was writing a relay robot to manage the communication between the Wave server to our Clojure server. More technically, our relay robot is written in Java and all it does is intercept the JSON objects coming in from the Wave server, post them to a web server running Compojure (a Clojure web server), wait for a response (the JSON object describing the operations to be done on the wave) and pass it back to be processed.
Is the REPL approach (in general) good only for the prototyping phase? Why would it be less cumbersome then a “standard” redeploy?
A REPL can aid in debugging a production server (you can eval in-memory databases and other diagnostics) and all steps of development (very quick modification of code and testing).