Thursday, March 10, 2011

LISP rant

I started to learn lisp december '10 with the book Programming Clojure. It was first language I started to learn in many, many years - being tied to Java.

I've been enlighted and astonished. LISP totally 0wned me for few months. I finally understood recursion, functional programming and many other important concepts of software craft.

I started to play with WebServices (AXIS) and twitter client. Then I wrote a very simple templating engine, similar to what can be seen in LIFT Framework. Started to think of building even more, but ...

then it came to me... I work too slow.

Yes, it took me far too much time to write all the above stuff. Was it my fault? Yes, of course. But it made me stop and look closer at the whole LISP thing.

Bad consequences of LISPing

  • At first glance, LISP (even Clojure) is as readable as Perl
  • LISP macros were a inspiration to C preprocessing macros. Anyone who ever tried to read huge code written in C, particularly GNU projects, would probably agree with me: this is unreadable stuff. You need to establish a parser in your head with a huge heap, just to read a few-liner.
  • Writing macros is the only possible reason to use LISP over other languages. But writing them is so damn hard, and you're stuck helpless with very unhelpful
    Var clojure.core/unquote is unbound
    every few minutes.
  • While having hard time with LISP, one might overlook how powerful Python become over last few years.
  • While wasting time on LISP one might not notice how Ruby is powerful enough to beat LISP with one hand, and serve you cold drinks while you enjoy your work. Yes, powerful enough. Can't imagine why would one want more than Ruby provides.
  • Clojure (no LISP actually) is not object-oriented at all. This makes you change the way you think, while the whole world of libraries is in fact fully OO. Hard stuff. Fun, but hard.
  • The whole concurrency-problem stuff that Clojure tries to solve so badly is way overrated. You just don't use global/class variables nor static fields (java) and you're good to go. In no time we'll see NoSQL databases or Memcached being used instead of IPC/SHM. General, simple, fast and handy. And thread-safe.
  • No one gives a damn what language you write your framework in. Customers care if they can easily navigate your website and if PayPal button works. Actually everyone should thing of end user and stop whinning about the whole languages stuff. PHP is better if your site written in PHP beats LISP elite code gardens.

These are bold statements, young man.

Yes sir! Thank you sir!

However I humbly ask you to please read these rants as LISP:
How I lost my faith (very long) - comp.lang.lisp | Google Groups - 2002
What are programming languages for? - by the same author, 6 years later.

Key quotes

What's more, once I got knocked off my high horse (they had to knock me more than once -- if anyone from Google is reading this, I'm sorry) and actually bothered to really study some of these other languges I found *myself* suddenly becoming more productive in other languages than I was in Lisp. For example, my language of choice for doing Web development now is Python.
There's another problem with the shorter-is-better premise, which is that the brevity of a program is much more dependent on the available libraries than on the structure of the language.
What I lost faith in was that Lisp was the best programming language for everyone (and everything), and that the only reason that people didn't use Lisp is that they were basically ignorant.
Unrelated, but too good to miss
In fact, I am in certain circles a notorious critic of UML, which I consider one of the biggest steps backward in the history of software engineering.


So.. sorry Clojure. Python won my heart by being simple (and not being PHP) when I was young. Now I'm mature and choose it because it's powerful enough for me and yet readable after years.