Arc Forumnew | comments | leaders | submitlogin
Lispy web development alternatives
11 points by lojic 5841 days ago | 8 comments
What are the reasonable alternatives to Arc with respect to developing web apps using a Lisp? Ideally, a solution would include the following:

  1) Core language is a Lisp
  2) Basic Lisp web server (cookies, sessions, etc.)
  3) Interface to PostgreSQL and/or MySQL
  4) Regular expression library
  5) Multiple public sites exist
I currently develop web apps using Ruby/Rails, and I'd really like to experiment with a Lispy alternative w/o having to experience lots of trial & error by evaluating many alternatives personally. A continuation server would be nice, but not required.

I think Arc has the potential to fill this role eventually, but the lack of an RDBMS interface is currently a deal breaker. The lack of a regex library is merely a nuisance. Lastly, the lack of any news from the front, and the possibility of having to port application code with each new release for a while puts a damper on the enthusiasm.

From my limited research, it appears that the PLT Web Server is worth considering, and for a Common Lisp alternative, it seems Hunchentoot with CL-SQL & CL-PPCRE has possibilities. But, the difference between theory and practice is much greater in practice than in theory.

Has anyone deployed a public Lispy web app (however small) and would like to share the URL, deployment details and their opinion of the pros/cons of the solution?



7 points by croach 5841 days ago | link

I've not deployed my own Lispy web app just yet (though I hope to very soon), but I can definitely recommend some resources for you that I used when I was doing my research on which Lisp alternative to use for web development.

First, the two main alternatives that I found were the ones you listed above, i.e., the PLT Web Server or Common Lisp w/ Hunchentoot. For the first one, I found two great resources, the first is from one of the PLT team members and is a small series on how to develop a reddit clone with the PLT Web Server--here are the links:

1) http://www.scheme.dk/blog/2007/01/introduction-to-web-develo...

2) http://www.scheme.dk/blog/2007/01/introduction-to-web-develo...

3) http://www.scheme.dk/blog/2007/04/introduction-to-web-develo...

4) http://www.scheme.dk/blog/2007/08/introduction-to-web-develo...

If your looking for a case study on using PLT to develop a website, then check out the paper by the guys at Untyped (http://www.untyped.com/)--they seem to be using PLT Scheme for nearly all of their web-based work--that describes their experiences in using the language/web server:

Paper - http://www.untyped.com/downloads/icfp068-welsh.pdf

Blog post - http://www.untyped.com/untyping/archives/2007/08/a_scheme_ca...

Also, Ethan Herdrick has developed the website Biographicon (http://www.biographicon.com/) using the PLT Web Server as well.

Now, as for Common Lisp and Hunchentoot, the best example I've found of how to get a site up and running has been the LispCast project which can be found here:

http://www.lispcast.com/

or, if you'd rather just have a direct link to the videos on Blip.tv, you can find those here:

http://blip.tv/search?q=Lispcast

For a good case study check out Brian Carper's blog. He has created a website that showcases his love for Origami using SBCL + Hunchentoot and he's blogged about it quite a bit. To checkout both his personal blog and the origami site, try here:

http://briancarper.net/

and here

http://origamigallery.net/

Those links should be enough to get you started in your research. Wish you luck, and remember to share your experiences regardless of which route you decide to go so that others that decide to follow in your footsteps will have an easier time getting started.

-----

6 points by jmatt 5841 days ago | link

Interesting! I just had this conversation with a fellow lisp hacker yesterday. What are the alternatives to arc? Or more precisely why not choose one of these other continuations based web frameworks over arc's web framework?

CL:

UCW - http://common-lisp.net/project/ucw/features.html

hunchentoot - http://weitz.de/hunchentoot/

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

Scheme (gauche):

kahua - http://www.kahua.org/show/en

Outside the lispy box - smalltalk:

seaside - http://www.seaside.st/

A thread on an actual enterprise web based lisp system:

http://groups.google.com/group/comp.lang.lisp/browse_thread/...

On top of this consider that if you use something like sbcl you'll then be able to use slime and all that it adds when debugging. Also you'll get a number of relatively stable libraries without having to port them to arc.

http://common-lisp.net/project/slime/

You also get some nice persistence libraries such as elephant in CL. These could make life easier if you had complex objects or structures that needed more than just hashs.

http://common-lisp.net/project/elephant/

I think the number one thing plaguing SBCL is multiple threads causing problems. A friend mentioned that hashes should be threadsafe now. That is a move in the right direction. I know I've had problems with threading in SBCL in the past, but that was years ago.

I have thought about what my back up is if I run into too many problems in arc or lisp. Especially if I needed to hire people or contract work. I have my own ideas for how to address such problems, but I think it should be kept in mind when making a decision as to what framework and language to use.

There are public lispy web apps out there. I just don't have a list of them right now. Notably reddit was written in common lisp. I believe sbcl was used, but not sure. Later on it was rewritten in python. The reason is undisclosed but if I had to guess I would say issues with threads.

-----

4 points by kens 5841 days ago | link

The reasons stated for the reddit move off Lisp are poor portability, lack of libraries, and a threading stability problem. See http://blog.reddit.com/2005/12/on-lisp.html and http://www.findinglisp.com/blog/2005/12/reddit-and-lisp-psyc...

-----

5 points by Zak 5841 days ago | link

I've deployed a couple sites for customers on Hunchentoot, one using CLSQL with PostgreSQL. Unfortunately, that one's covered by an NDA. The other, I can talk about, but I won't post the URL as the nature of the application means that random people using it would only serve to irritate the customer.

It's a web-based file transfer system allowing anyone to send files to the customer's employees and the employees to send files to anybody. It sits behind Apache using mod_proxy and gets its main template by loading a Wordpress page over http. Wordpress can play nicely with it since the html template library does everything in comments.

Pros:

Hunchentoot is really nice and hackable. One highlight: I added an :around method on dispatch-request to check to see if an IP is banned, and handle the request appropriately.

Like most Lisp web systems, you can get a REPL on a running server. I use detachtty for this.

You have a few options for how to install the app (lisp source, fasls, core images and with some lisps, a self-contained executable). They all work.

It's not a framework. You can do things how you want to without having to fight with your libraries.

Cons:

I had some problems deploying on a VPS (Mediatemple DV plan, to be specific). SBCL and CMUCL didn't want to run, complaining about a memory allocation error. Limiting memory usage with the --dynamic-space-size argument works, but means setting a static memory limit for your app. I haven't had problems on two other VPS hosts, but some other people have.

You'll want to

  (setq cl-ppcre:*use-bmh-matchers* nil)
or you may run out of memory anyway. In fact, you'll probably want to do that most times you use cl-ppcre.

It's not a framework. You'll have to decide how to do everything, often choosing between several libraries with no obvious best choice, or writing it yourself.

-----

4 points by skenney26 5841 days ago | link

I haven't tried it myself but Slava Akhmechet (defmacro.org) created a web framework for Common Lisp called Weblocks (http://common-lisp.net/project/cl-weblocks/).

As far as the lack of a regex library in Arc you could probably make use of PLT MzScheme's built-in support for regular expressions (http://download.plt-scheme.org/doc/mzscheme/mzscheme-Z-H-10....) or the pregexp.ss library (http://download.plt-scheme.org/doc/mzlib/mzlib.html) for Perl-style regex. Anarki allows you to call scheme functions from within arc by using $:

  ($ (sin 1))

-----

4 points by croach 5840 days ago | link

I wanted to add one more source. This tutorial just popped up on Reddit this morning and covers the creation of a web app using Common Lisp, Hunchentoot, CL-WHO (HTML generation), and ParenScript (for Javascript generation). I haven't had a chance to read through it just yet, but it looks very thorough and easy to understand.

http://www.adampetersen.se/articles/lispweb.htm

-----

1 point by th00ster 5828 days ago | link

Well, there is still newlisp, which gets much less publicity than it probably deserves.

I'd like to point you to http://www.newlisp.org/index.cgi?page=Features

I have written a blogging engine in newlisp, which atm is unfortunately only deployed locally, because it is still pretty much in alpha stage and does not feature capchas for comments yet...

well, take a quick look at the features page mentioned above and tell me what you think.

-----

3 points by absz 5827 days ago | link

NewLISP has been discussed before on these fora (such as at http://arclanguage.org/item?id=244), and in fact you once brought it up yourself (http://arclanguage.org/item?id=2887). You may recall that it was roundly panned by many people (myself included). Summarizing these threads, here are two of the main reasons:

1. One-reference-only storage. This means that something like (cdr lst) must copy the entire list, makes it impossible to create cyclic data structures, etc. As a consequence of this, variables are not passed by reference.

2. Dynamic binding/lack of closures (and continuations). This is one of the worst, in my view; I find dynamic binding confusing, opaque, and (potentially) bug-prone. It may well have its uses, but not as the default.

The general workaround for these is the "context". This appears (I am not an expert) to be a rudimentary module system that works by prefixing defined and referenced symbols by context-name:, unless they are already so prefixed. To pass something by reference, you must pass in its name (such as 'xs), rather than just the value (such as xs). You must, however, take care to prevent variable capture (!), and wrap your names in contexts. This is how lexical binding is simulated.

There are other, smaller issues that people have, and there are certainly things it gets right (e.g. it appears to have regular expressions). But they are eclipsed by the major flaws outlined above.

-----