Monday, December 05, 2005

on lisp

After reading the comments on the last post, figuring out how to articulate the reasons for our switch from Lisp to Python feels very much like figuring out how to articulate breaking up with one's girlfriend. Thoughts like "It's not you, it's me," "No, i haven't had Python in my head this whole time," "Lisp was a lot of fun. Really, I'll always cherish these memories," keeping parading about in my head.

Lisp is an amazing language. After spending the entire summer working entirely in Lisp, it's nearly impossible to work in another language and not say to myself, "If only this were Lisp..." Lisp has many goodies that make programming in it a joy: the REPL, macros and the lack of syntax are some. I won't go into the details, but rest assured, it's cool. People become Lisp zealots for a reason.

On a side note: Please ignore the comments that claim the Lisp community is harsh on beginners. The guys on comp.lang.lisp are very helpful (as with any newsgroup, you will get flamed for asking a question that can be answered with a single Google query, trying to cheat on your homework, or picking a fight). In addition, the bloggers who contribute to planet.lisp.org are all working on interesting things and are a great resource. The Lisp community may be small, but it is a good and helpful community nonetheless.

On that note, if you have been considering writing a web application in Lisp, go for it. It will be tough if you're not already a Lisper, but you will learn a lot along the way, and it will be worth it I am sure. Lisp is especially great for projects where the end goal is unknown because it's so easy to steer in different directions. Lisp will never get in your way, although sometimes the environment will.

Emacs and SLIME are a killer combination, but I develop on a Mac, and reddit.com is a FreeBSD box. On my Mac, my choices of threaded Lisp implementations was limited to OpenMCL, and in FreeBSD it's CMUCL. Because of the low-level socket and threading code we had to write, reddit would not run on my Mac, and I was always tethered to our FreeBSD development server. Not being able to program offline is a pain.

If Lisp is so great, why did we stop using it? One of the biggest issues was the lack of widely used and tested libraries. Sure, there is a CL library for basically any task, but there is rarely more than one, and often the libraries are not widely used or well documented. Since we're building a site largely by standing on the shoulders of others, this made things a little tougher. There just aren't as many shoulders on which to stand.

I am a little saddened to see so many posts along the lines of, "I'm so disappointed." And I'm actually surprised so many people care about the implementation language in the first place. But I guess it was Lisp, after all :)

So why Python?

We were already familiar with Python. It's fast, development in Python is fast, and the code is clear. In most cases, the Lisp code translated very easily into Python. Lots of people have written web applications in Python, and there's plenty of code from which to learn. It's been fun so far, so we'll see where it takes us.

Regardless of Python, reddit was begging for a rewrite. Whether it was the best decision to do it all at once is up for debate, but I'm very pleased at the way it turned out. We nabbed a number of lingering glitches at once-- glitches that would have been messy to fix incrementally because they were rooted in the early designs of reddit. Given that the reddit code itself is not incredibly complex, and we could use almost all of the old HTML, Javascript, and CSS from the original version, a rewrite seemed the easiest solution. The entire task took less than a week, with 80% of the code written in a single weekend. Yes, there a bugs we will have to fix again, and plenty of new ones as well, but in the long run it'll be worth it.

All that being said, we've got a lot of cool new things on the way that were excited about. I can't wait to introduce some of the new bugs we've been working on as well.

PS - If there's any interest, we could always document the process we went through developing the Lisp version of reddit so others trying to learn Lisp can learn what we know.
discuss this post on reddit