Maybe Give that EMACS a try again…
I don’t know why but I have had Lisp on the brain for the last few days. I think it was because I was thinking of switching back to emacs. How many times have you heard this story. “I used to use Emacs, but then after switching computers, I lost my .emacs file so I just switched back to Vi.” That’s me. After one quick look at the ubuntu app search, I found that they are on EMACS 21 and the world and all their new goodies (Rails on EMACS are on EMACS 22. After about 20 minutes of that thought, I happily went back to using Vi. When I have a spare week, I’ll spend the time re-introducing myself to EMACS and it’s internals… or so I thought.
LispBox & Web Serving
Later on that evening, I did read a blog entry on some lisp programming that pointed to Peter Seibel’s LispBox. Aha. He gets it. I don’t want to screw around figuring out stuff… I want a one click install to the magical lisp stuff. I’ve tried to setup EMACS in the past to have all the bells and whistles necessary to do C++ work. That isn’t an easy task. This was not going to be like that, so I gave it a try. Specifically I tried the Allegro Install since the disclaimers said it would have the most magic. I don’t mind commercial software and I want to see the polished tools.
I ran the software. Very nice. It has the famous SLIME extension to EMACS already lit up. It definitely had that feel like… this isn’t your normal Editor/IDE environment. I’ve used EMACS in the past, this was a bit slicker. It reminded me a lot of the Smalltalk browser/eval system. This might be a little bit like what those old Symbolics guys would rant about. After I got over appreciating that, I immediately went to the chapter in his book on web programming. I tried out the examples. I got some web pages to serve and then after noticing the time, pretty much stopped there.
I needed to get back to work on some other stuff, and that whole experience was fun for about 20 minutes.
The next step for me is to spend some time learning about this particular REPL environment.
I’m just not even remotely familiar with it to be productive.
I need to learn the Ruby equivalent of…
“what is that Ruby method on a string?? hmm.. I’ll just do.
Oh yeah, that is the one.”
Done. This is not a Lisp failure, this is a me failure. I just need that tool in my tool chest before I spend any more time on this. Until then, it is good to know, though, that when I have the time, the environment is there waiting for me… all set up and ready to go.
Thought. Is there a Rails for Lisp?
My curiosity from the web exercise did leave me with a question. Was there an equivalent of Rails for Lisp. I’ll bet with a completely dynamic environment like this, there has to be something like Rails.The web stuff in the Practical Lisp chapter was pretty barebones. Any good web development framework today needs to be on par with Ruby on Rails. After a little searching, I found a few scraped together libraries. None were top-to-bottom frameworks. There were lots of posts on the Reddit ‘fiasco’. There are also a lot of good posts on Erlang which does have a Rails like framework called ErlyWeb (more on that later). There is also Arc… but we’ll have to wait until that comes out to see if that is going to be interesting. Nope, it doesn’t look like the community has anything yet.
Hung Up on Threads Again
One interesting thing to note. The lisp community (like a few other languages) seems to be hung up on having a multi-threaded lisp implementation for web serving. Why? If the LispBox sample is any indication, only a few of the frameworks were capable of performing the samples in the book. Also, from the Reddit fiasco posts, there was mention of the servers having deadlocking issues. Why are they hung up this? Do they really want to follow in Java’s footsteps on this? Unfortunately, this isn’t a ding on Lisp. A lot of languages have problems with the hosting environment. The only major one that doesn’t is PHP. In an old post on PHP, I elaborate a tiny bit on the benefits of the PHP multi-process model.
For the Lisp situation, I don’t know enough to understand why most of the web stuff requires a multithreaded common lisp system. Is it the sexiness of having all the data available as shared state? Maybe the warmup time for the runtime is quite high. More likely, it is the memory footprint. I took a look at mod_lisp, and it just uses sockets to communicate to a long running process. I think the community should look at multi-process based solutions if they want to have scalability and reliability. They could then use any of the runtimes that they have available right this moment.
Back to the Real World
Anyways. I resumed my work back in the real world. Towards the end of the day, however, I was scanning one of the iphone dev groups and found this post by Jesse Andrews. The subject was about a caltrain schedule app for the iphone. That sounded interesting and I could actually use it. So I checked out the post. As I got to the bottom of the post, he mentions that he found some “hunks of lisp” in the html of the site.
What? Lisp? Again I got excited and raced to do the ‘view source’ on the page. What would it reveal about the framework that they used for their site??
(while (re-search-forward "</th><td" nil t) (backward-char 3) (save-restriction (narrow-to-region (point) (progn (end-of-line) (point))) (goto-char (point-min)) (let ((s '(1 1 3 2 3 2 3 2 2 3 2 3 2 2 3 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 3 2 3 2 3 2 2 3 2 3 2 2 1 1 1 1 ))) (while s (re-search-forward "\\(<td[^<>\n]*>\\)\\([^\n<>]*</td>\\)") (replace-match (format "\\1<!%s-%d%s->\\2" "-" (car s) "-")) (setq s (cdr s))) (or (looking-at "</tr>") (error "Foo")))))
I’m not a lisp expert but that sure looks like EMACS lisp. So this doesn’t count as a lisp site. It might qualify for a daily WTF, though.
Hmm. Still, maybe I should look at EMACS again.