Mohegan SkunkWorks

Sat, 13 Mar 2010 17:39:02 EST

cl-mongo now on multiple lisps.

cl-mongo now runs in the following lisp images : sbcl, clisp, allegro common lisp and clozure common lisp. I was not able to get it working with armed bear common lisp.I originally used sbcl to develop cl-mongo, but it is my goal to be able to run it on most lisps.

To get cl-mongo to run with clisp I needed to make only one fairly minor change in the networking code.

When you send an insert to mongodb, it does not respond back. When you send a query request you obviously do get a response back. Since I'm using the same socket connection for writes and reads I need to have some mechanism in place to wait for a response, when one is expected. A blocking read on the socket is out of the question. That would destroy performance.

I 'm using usocket as my socket api. usocket's api description recommends listening on the socket stream. This worked fine under sbcl.
clisp's implementation of listen however does not support this sort of functionality for binary streams. Instead I use clisp's socket status.

clozure common lisp was not happy with my use of call-next-method in cl-mongo's db.find implementation. Rather than rely on clos to string subsequent calls together, I used an explicit call to db.find. Lastly, clozure has it's own implementation of cwd, so I 'm no longer exporting this for clozure. I use cwd to return the name of the current database in cl-mongo.

Armed bear common lisp doesn't compile the babel package.I use this package to generate utf-8 compatible strings, and that's pretty essential as mongodb expects all strings to be utf-8 encoded.

Finally, allegro lisp had no problems compiling and running cl-mongo.