Saturday, February 5, 2011

Clojure: all the way to lisp

Sometimes, when learned Java developers have to face serious critics to their favourite language (Java), a famous quote from Guy Steele is cited in response:
And you're right: we were not out to win over the Lisp programmers we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp. Aren't you happy?
By the way, for those who are in this kind of stuff, here it is the original discussion (2003), entitled "bindings and assignments" and and the quote was given as an answer to McKay claim that Java success was more due to Sun marketing than to effective Java merits. There are a couple of things that immediately strike me:
  1. Steele is not even trying to defend Java. He is not saying that Java is particularly good, he limits to say that taking Lisp as the ultimate language, Java was a meant to bring the blub programmers from C++ to something slightly more lispish. He is almost apologising: "we had finite resources, facing an apparently finite window of opportunity". In fact, I like his aptitude. He is very honest in the discussion, even if facing some rather strong critiques, after all he had been told that Java success is not due to his merits as a language designer, but to right marketing choices from his company.
  2. Java does not look akin to Lisp at all. I mean, if you look at Ruby, for example, the influence Lisp had is very easy to see (much more evident than for Python, for example). Java looks very unlispish, indeed. My opinion is that the less lispish thing Java has is the syntax. It's not even the static typing or lack of closures or functional gimmicks, which can be implemented in an object oriented way, indeed. The point is that the those implementations take a huge lot of code and syntactic noise to be used. Lisp was about hiding the noise behind a macro. Java brings in the noise and multiplies it ten folds.

Now, where are we going? We are going in the clojure direction. After ten lots of years of Java, it is apparent that the blub programmers dragged halfway to Lisp were infinitely distant from good programming and consequently still are. They blubbed in C++, when C++ was cool. They blub in Java, now that Java is cool. Even if it is kind of an heresy, I bet they will blub in Python if Python will become the next big thing in enterprise (or in Ruby, or whatever). Please note that Graham was implying that languages are partially ordered (with Lisp on top), while I do not have this opinion. Moreover, there is a whole new generation of people who believe that Java is really cool and perhaps do not know everything but Java. I have even lost the url of a very informative post of an American professor pointing out how the industry is unsatisfied of the very low average skills graduates have.

Those programmers, use Java very badly. Java is extremely good at hiding its good features, indeed (and it hides them behind a huge wall of stolid syntax). And in fact Java is not as bad as most people thing. This is evident if you stumble into code from people like Bob Martin or Fowler. But this is not even the point. As it is not the case to point out the continuos struggle that Java developers face against Java purportedly greatest features (checked exceptions and static typing). There are huge libraries and frameworks which basically just try to make static typing less painful.

So what now? We have clojure. If Java dragged those programmer halfway to Lisp, Clojure should drag them right all the way in. Afterall Clojure is Lisp. Some might prefer Common Lisp (I do) or Scheme, but Clojure is Lisp nonetheless. They can be dragged all the way to lisp. They have their libraries, their tools. And they have Lisp. They can call Java in both directions. Program in object oriented ways, program in functional ways. Mix the two. Hack with a new wonderful concurrency models (I hate Java threads).

The point is that those features will be simply above the grasp of most people. It was pointless to bring people halfway to something they will never reach. Even not that they could.


2 comments:

Alfredo said...

I can't understand if this is a praise of Clojure or not, but I think we have to realize that our perfect-Lispy-world is more than just a dream. Lisp is designed for alien civilization, not for humans, after all. Maybe in a very far future we could program in Common Lisp again. Meanwhile we have Clojure, a fantastic bridge between human and alien technology so... I want to take this bridge and see where it could lead me.. You will across this bridge with me? :=)
Bye,
Alfredo

Unknown said...

It is neither a praise nor a critique. I try to make a summary:

Steele said that Java brought C++ programmers halfway to Lisp. I'm basically commenting on this, with Clojure giving them the opportunity to go all the way to Lisp starting from a very familiar setting.

I started using clojure "for real" rewriting some classes in a pretty large project. This is awesome: I could not have done it with other Lisps (at least, not with the same ease and acceptance, AB Lisp for example could have done it, but Clojure is built from the ground to play along with Java).

Believe me: just the fact that should I need it I can add a jar file and start lisping makes working in Java much more bearable.

I definitely love Clojure. I was just wondering if it is going to see wide adoption in "blub circles".
I believe that it does have the possibility to do so (as it's easy to inject in existing environments and is very easy to use -- and knowking that they can always resort to more javish stuff for them is a plus --). However, I'm afraid it won't.

Java has some nice features that are scarcely used in practice: in fact enterprisey code tends to be dull (and for a good reason, the lone computer cowboy is a serious issue). As a consequence, I don't think clojure will see wide adoption in those settings *because* it is very nice, on the other hand it will be adopted in more extreme settings (the ones who code nice Java stuff even today).