Weblocks - A Common Lisp web framework

Tuesday, July 3, 2007

What?

This will be a quick and dirty post. Over the past couple of months I've been quiet. I didn't fall off the edge of the Earth. Instead I've spent all my time writing software rather than writing about software. A few months ago I quit my job to do things I always wanted to do. One of them is writing a web application framework in Common Lisp.

The framework is very close to being ready for public consumption but it isn't there yet. I am giving everyone a sneak peek because tomorrow I am going abroad. I will be gone for three weeks and I want to let people know what I've been working on before I leave.

I put together a demo application that runs on a VPS host here. This is a Ubuntu machine running SBCL and Hunchentoot. In case the server goes down while I'm gone you can find (somewhat stale) screeenshots here and here. If the server holds up, do check out the incremental search on the grid - my tribute to Emacs!

If you want to play with the source the darcs repository for the framework is here:

http://common-lisp.net/project/cl-weblocks/darcs/cl-weblocks

Updated: 08/18/2007

And the repository for the demo application is here:

http://common-lisp.net/project/cl-weblocks/darcs/weblocks-demo

Updated: 11/19/2007

The code is relatively clean but as I said earlier - it isn't quite ready for public consumption. You've been warned!

How?

The framework is similar in spirit to UCW and Seaside. It is heavily based on widgets. I probably would have ended up using Seaside if Smalltalk supported multiple method dispatch and didn't force me out of Emacs. I didn't use UCW because of a serious attack of a Not Invented Here syndrome.

I did not yet implement modal requests. When I do I will likely not use continuations. I have a pretty good idea on how to achieve modal programming style with coroutines.

I make very heavy use of closures and multiple dispatch. Some parts of the framework also put more esoteric features of CLOS and MOP to the test. I use introspection heavily to generate HTML - I couldn't stand using template engines anymore so I wrote code that does the dirty work for me. Macros are put to very heavy use via Edi Weitz's excellent CL-WHO. I suspect I'll use them heavily to implement coroutines.

AJAX is supported automatically for all widgets except the navigation (in order to allow for friendly URLs). The framework automatically scales back - everything still works when JavaScript is turned off. Closures allow writing code as if the client and the server are on one machine and HTTP doesn't exist. Some MOP specialization allows automatically determining when widgets have been modified. Together these features let the framework turn AJAX on and off in seamless manner without any boilerplate code.

Why?

I suppose the same reason why George Leigh Mallory wanted to climb Mount Everest - because it's there. Unfortunately the biggest challenge turned out to be porting the stylesheets to IE 6, but that's a story for another day.

What's Next?

I have a lot left to do. Implementing modal programming style, more cool (and useful) widgets, writing tutorials, publishing API documentation, setting up public wiki and bug tracking are some of the items on my to-do list.

See everyone at the end of July when I come back!

Comments?

If you have any questions, comments, or suggestions, please drop a note at coffeemug@gmail.com. I'll be glad to hear your feedback.