main logo

I'm Sebastien Orban and I'm a hacker and a painter.

25 March 2014

Why Clojure ?

For a while Clojure is on my plate for various reason - at the origin, because I wanted to learn a LISP but not fight with Common Lisp library avaibility (Quicklisp help but it's status is always in question), Scheme multiple incompatible implementation (even if I'll have someday to make due with Racket if only for finishing the often delayed SICP reading). So the pragmatic choice left on the table was Clojure. Now that I'm getting a better feel of the whole deal, I'm getting more and more happy that it's my current choice and I'll explain why here.

First : it's not only available on the JVM, but too as a language that can target Javascript. There's some other implementation, but none that are as alive and as useful for now. Still, it's interesting to get the same langage on the server/desktop than in the browser, or, as it's getting more and more popular, on the Node platform. The limitation of each target are still there, but since we can easily move on one or the other side without much to re learn, it's a very interesting gain - and this lead us to the nex point.

Lightable is a new text editor - founded on Kickstarter, now too in the YCombinator pool, and using as you may already haved guessed, Clojure at its core. In fact, it's not exactly Clojure, but ClojureScript on top of Node with a Chromium frame... lost ? It means we're using a webview with some Clojure compiled down to javascript- and the goal of that is to make the editor as extensible as Emacs is with Emacs Lisp, but without the stigma of using directly a lisp if it can be avoided. ClojureScript is their main choice for dev, but we can write anything that can go down to Javascript to extend it after all. And it too means that we get the "ease" of working with HTML for everything, practical isn't it ? But well, my love story with Lightable is for another post.

Another point of interest is, since it's targetting pretty well known already existing "platform", we can use a lot of library without going all the way down to C foreing interface as in most other language. A benefit that is hard to quantify, since it still means we have to deal with the nasty rotten bits of those platform, and Java seem to lead the programmer to produce some of the nastier bits I've ever seen.

Still, getting a nearly free pass for an already loaded ecosystem means we don't have to fight, wait, or re create anew the same stuff. It can too means that we'll get some incompatible library, wrapper and so on available on each version of the language - got already bitten by it, but this was a small stinks.

Now there's too the more usual argument in favor of it : it's a functional langage, there's the lazy collection, its threading system is very good, there's some very nice and exciting project going with it (logic language define in it, type checking as a library, Datalog...), but I get the feeling it's already a path well beaten. Suffice to know : it's a language that neckbeard and hipster can agree on.

It's not without warts mind you : the fact that it's on the JVM will still give sometimes strange error that can be hard to parse in an external to java context. Some library are quite young, the langage is still evolving a lot (not to the point of Scala or Rust, its core stay more or less stable) and, well, it has some of the Common Lisp irk that can get to you... Mostly in the forms of a sometimes superiority feeling that can arise in some personality, but it's not the norm ! In fact, the community is quite cool and open.