lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I'm not a big Lua user, but I really like this language. To improve my skills and learn more about it, I just implemented a continuation-based web server. For those who don't know, a continuation-based web server tries to work around the statelessness of the HTTP protocol : instead of generating pages after pages and keeping manually track of a session through cookies, the developer is just writing a set of functions (actually closures). These closures are called, one after one, on each request.

I didn't code it from scratch : it's actually a reimplementation of Arc Lisp's web server. The original program is a brillant piece of code from one of the first web applications developers (and a well known lisper), Paul Graham. Now that I used it, I really find it hard to write non-trivial webapps with other frameworks/languages. The problem is that Arc lacks a lot of libraries and is not that easy to make communicate with other languages. That's why I wanted to implement it in another powerful, easy to extend/embed language.

Using Lua for this was really interesting. The most disturbing thing is the fact that functions can be called with any number of arguments, thus leading to naughty bugs (that's especially true when you're carrying closures all the way long).

The code is available at http://github.com/sacado/luarc/tree/master . Please let me know if you find this interesting !
(note that this is a very first release ; the code probably contains a few bugs, but it is already usable for simple webapps.)

--
sacado