ClojureScript is a relatively recent addition to the list of languages which compile to JavaScript. Unlike some such languages, it does not only fix the minor difficulties with JavaScript (like syntax oddities), rather it is a wholly different language with a LISP-like syntax and very powerful semantics. Many words have been written on “why ClojureScript”, which I won’t attempt to restate here. Rather, these are the handful of reasons ClojureScript is worthy of a deep dive for projects like ours (at work).
Strengths (for us)
- It is a “programmable programming language”, especially good for building abstractions – the usual LISP strength.
- It is biased toward immutability and functional style (though many things are mutable, because of JavaScript underneath); yet can easily escape when pragmatically needed.
- Is it is possible to use the same(-ish) language on the client and server; our projects benefitted from this for years in the boring old days of desktop client-server development.
- Client side ClojureScript is built on JavaScript runtimes and libraries: proven, strong, dominant, multiplatform.
- Server side Clojure is built on Java runtimes and libraries: proven, strong, dominant, multiplatform.
- Although there are not a great number of ClojureScript developers, they tend to be good developers.
Weaknesses
- Although parentheses-first syntax does not bother me, it does bother some developers.
- ClojureScript is different enough from JavaScript that knowledge of the latter doesn’t help much with the former;
- Yet, it is still necessary to know JavaScript well.
- There are at least 100x fewer ClojureScript developers than JavaScript developers; perhaps 1000x.
- Fits well with some JS libraries, less well with others – sometimes that prevents the “shove in an hack” style of development which is JavaScript’s strength and weakness.