Warning : This is a rant, so if you are in here for erudition, then you must be looking somewhere else…

I have been mucking around python for sometime (2 years to be precise) and I am almost confident in saying that I am a pretty good python programmer. I took one look at lisp (scheme rather) a couple of years back, and chose python then. I do not regret that choice.

In the past two years, I’ve looked at a lot of languages (including ruby) and nothing took my fascination as much as python did. As every C/C++ programmer I am annoyed by the indendation rules. I know those rules make my code look more readable, infact I indent any of my code like that with a new level for every block. I did that with C more than 6 years before I was doing that with python. With python its been more of a landmark-coupon effect with me. Its like, I know I will spend this 1000 bucks at my nearest landmark, but I just hate it when people give me a landmark-coupon for the same 1000 bucks as prize money. Its a bit irrational, but thats how I am. Anyhow, as I said no other language took my fascination, untill I came across Lisp. Lisp was a mind-blowing piece of computer science. If you are in CS, and haven’t taken a look at lisp yet, stop reading this right now and go here.

A few months back, I was commisioned to do a project for a lab in bangalore. After extensive internal discussions with the people involved we finally settled on python. We had debated about lisp then, and since the lead din’t feel lisp implementations were either not “free enough” or not “mature enough”, I had to give up, and now, this where the actual rant starts. Every moment I was running into some thing that python din’t allow me to do in a easy way, I was thinking of “now, if it were lisp…..”. Every time, my list comprehensions grew to more than one line, and started looking plain ugly I wished I had “loop” there. But these were minor annoyances, I got most of the power of loop with generators + side effects in python for all my needs. And I went on hacking and completed the project. The lead was impressed. However, she also asked me any good reasons where I could have used lisp here. I had plenty, but nothing impressive enough then.

But, now in retrospect, I realised the biggest need where lisp would have fit in. True Multi-Methods and a bit of macro-magic. The project invovled extensibility of classes at runtime, i.e I needed to create dispatch handlers at run-time. In python I ended up creating my sweet own version of multiple-dispatch, based on string messages and “function objects” (thats what Guido calls closures). I’m no expert on design patterns, but I guess they have a quirkily named pattern for that too. Maybe I built lets say 25% of the functionality of CLOS. Now, if I had lisp, I could have done with 25% less code. Infact, add a bit of macro-magic to what I did, and probably I could have done with 50% less code. (and probably, since its 50% less work for them, I would never have been hired).

Now, about the macro-magic I was talking about. It would have also helped the users of my code. Since it is a framework, rather than an end product in itself, and hence users are mainly programmers, but from more mathematical and scientific backgrounds, who care less about “design patterns” and more about getting “my experiment over with”. Also, it would have helped me save millions of cuts/paste and arduous editing, which would be way better done with a macro. Many people seem to think that using lisp macro’s are a maintainabilty issue. The basic thing here to understand is that, as your abstractions get better, your ability to look at the code and understand it just like that decreases, but the benifit there being, working with a code is such a breeze. So, there is slight maintainability issue there, but thats no different from highly OO code. The most common complaint you see with anyone doing java is the complexity of the frameworks. With a million classes, each having a million functions, doing very similar things. Ruby solves the problem with a compromise of a solution – mixins, but its just a compromise. Interestingly ruby also solved my previous problem with keeping classes open. That shows, that I should probably take another look at ruby, but now I am hooked to lisp.

And, now the downside to lisp? No, there is nothing wrong with Lisp, the language, its pretty asymptotic to the “prefect” line. My gripe is with the community. I have a typical newbie problem with python, I can probably find more newbies having the same problem and a google search gives me the solution. Python is batteries included, Lisp is not. When I want to handle a http-get in python I simply think of urllib, and in Lisp? Its not like there aren’t libraries out there, but just lots of them, and not all are really well maintained. and probably wouldn’t work on every implementation. And c.l.l is one of the easiest places to get labelled a “troll”.

And in fact, I have a hypothesis why that happens. The problem with complete newbies is that they start from a C/C++ background, and come to lisp. And then they ask really really stupid questions. (even I had some of those, but just that I was smart enough to ask it too google). And c.l.l has one of the highest density of smart people around. They might be small in number, but they are possibily one of the smartest groups online, and smart people can’t stand stupid questions, whereas newbies can’t do without them. The “be good to the noob” mindset is comming more often these days into c.l.l, but it needs to improve a lot.

And, then there is the classic chicken and egg peer issue. There aren’t that many lisp programmers around and I really can’t work on lisp, except for my own stuff. Its easier to find python programmers, heck even ruby programmers seem to be more in number than lispers. So, if I do end up writing lisp code, Its hard for me to get it peer reviewed, and even worse get a team member to work on with it.

Hmm, thats with the rant I guess, till later..

Signing Off,

Vishnu Vyas