Ruby and Lisp and the Web

December 4th, 2005

I promised my programming languages class that we’d look at Ruby before the semester is over and now it’s time to deliver. I made this promise partly to force myself to learn more about Ruby and Rails. As it’s often the case, the instructor ends up learning much more than the students. Ruby sure looks interesting, fun and useful. We have a highly functional, semantic-web enabled site built with php and mysql, but the innards are complex and hard to understand. I’m sure that a rails implementation would be much simpler and easier to maintain and extend. I found a long and thoughtful blog post by Eric Kidd comparing Ruby and Lisp.

“Years ago, I looked at Ruby and decided to ignore it. Ruby wasn’t as popular as Python, and it wasn’t as powerful as LISP. So why should I bother?

Of course, we could turn those criteria around. What if Ruby were more popular than LISP, and more powerful than Python? Would that be enough to make Ruby interesting?

Before answering this question, we should decide what makes LISP so powerful. Paul Graham has written eloquently about LISP’s virtues. But, for the sake of argument, I’d like to boil them down to two things:

  1. LISP is a dense functional language.
  2. LISP has programmatic macros.

As it turns out, Ruby compares well as a functional language, and it fakes macros better than I’d thought.”

Ruby even has continuations, which, as Mikael Brockman shows in his entertaining post continuations on the web, simplify web programming.

Finally, if you want to check out Ruby for the first time, try why the luck stiff‘s Interactive Ruby tutorial.