Sign in
Log inSign up

Problems that prevent me from using ClojureScript in production

Jon's photo
Jon
·Nov 9, 2016

I'm using ClojureScript for my personal projects for a year now. There's still a lot to learn but I have already built lots of tiny things with it. And it's long enough to sort out my own Workflow of writing cljs that power dozens of small apps. After training of Functional Programming, now cljs is the best for my thinkings. So I bet on ClojureScript.

But as I said, I don't use it online. One of the obvious problems is very few people in China like Lisp. But to me it's not the thing I concern most. If cljs is great, people will change, but there are definitely shortcomings in building apps with cljs. Here are my concerns.

Reusing packages from npm

Interoperability between cljs and js is important to the work in companies. We can not build everything so reusing js code is essential, and mainly code from npm. Yes we can pack js code into a jar and let Closure Compiler import js code, but for the numerous package on npm, we can't.

I saw the message on Twitter that Closure Compiler team is working on it. That's cool and I really need that.

dynamic loading

Webpack has changed the community a lot in the past years. Now we are sure that even in writing single page apps, we still have to split code and dynamically load them in production. So with Closure Compiler it's trivial to split code, but how to load them in our business code? I don't get an obvious answer yet.

Long term caching solution

A Webpack feature again. But I still have to revision my js files before sending them to the CDN. I tried boot-rev and it solved part of them problem. I would be better if there is a more complete solution.

Bundling static assets

Webpack feature. Closure Compiler is not designed for packing CSS and font files. A common solution is to use Webpack alongside Boot. It's workable. But as a result it get complicated to build due to the involvement of two platforms. Meanwhile to install assets from npm, which Webpack can recognize, we need a package.json to manage the dependencies too. Just complicated.


The are also less crucial ones, but not good enough compared to other altjs langauges:

Learning

Well, many programmers in China jokes about Lisp without really writing programs in it. It would take a lot of time to change that. New concepts like lazy evaluation and Macros will blow their minds.

Performance

These ones are not that crucial since we can use js to boost the prefs. But when persistent data structure is heavily used it can be very slow and cost quite some time to optimize. Newcomer won't find it easy to do that.

Debugging

Even with SourceMaps enabled, debugging in cljs is not as plain as in js. I sometimes ran into situations that call stacks are missing because of lazy evaluation. Also it's an obstacle we are not able to operate data in the console in the scope of a break point.


I would love to try ClojureScript in production after spending so many time exploring it. Just hope it's getting better before I have to try other jobs.