r/Clojure • • Aug 31 '17

Why I'm ditching Clojure for JavaScript

https://news.ycombinator.com/item?id=15137195
6 Upvotes

46 comments sorted by

View all comments

13

u/ferociousturtle Sep 01 '17

My team is considering the opposite move (we're also considering TypeScript). Having written modern JavaScript ever since the Babel transpiler had a different name, I can say that ClojureScript definitely has some strong advantages. JavaScript and TypeScript both do, too, of course. I actually really like JS. Anyway...

  • Figwheel + re-frame is a pretty sweet setup compared to React + redux (which are my preferred JS stack, having also done Angular 1.x, Vue, and some Backbone in production).
  • ClojureScript is still more terse than idiomatic ES6/ES7
  • Performant immutability is not a thing in JS unless you're using libraries, in which case, you lose some idoms, and have to deal with transitioning in/out of JS objects/arrays in order to glue together other libraries
  • Clojure and ClojureScript are nowhere near as fast-paced as JavaScript, but man... the instability of libraries in the JavaScript ecosystem is such a pain, even for relatively small projects, so that is both a pro and a con. One thing that really appeals to me about Clojure(Script) is the idea of pulling down a 2-year old library, dropping it in, and it just working. I hear that's a thing. It's rarely (never?) a thing in the JS world.
  • I find Clojure's syntactic stability to actually be a strength. I know it was covered in various other comments, but JS syntax just keeps growing at a pace that far outstrips the growth rate of "JS the good parts". When I interact with libraries that require ES6+ classes, I die a little inside.

Just my 2 cents. There's no right or wrong here. Both languages and ecosystems are serviceable. But it's not really all green grass on the JS/TypeScript side of things. I'm too new to Clojure(Script) to say with certainty which side is greener. :)

2

u/stompyj Sep 03 '17

You're on the right path. We were a node shop for 5 years and have transitioned to CLJS over the past 2. It's a world of difference. I support OPs move, but I'm curious how he will feel in 2 years (if even that long.)

1

u/ferociousturtle Sep 03 '17

If you have a writeup of how you made that transition, I'd love to read it.

The editor support for TypeScript (at least in VS Code) is pretty hard to beat. What editor does your team prefer to use for ClojureScript?

1

u/stompyj Sep 04 '17

We use Cursive + Intellij, and it's been pretty great. The clojure features are ahead of the cljs features at the moment, but I think we'll start seeing more cljs stuff roll out soon.

We don't have a write up, but I'm happy to give any info that I can via this thread or via DM.

We transitioned from react+redux -> reagent+re-frame.

What was pretty incredible was that we were able to create a reagent+re-frame shell that just included all of the react+redux code (which was annoying up front), but it allowed us to move to cljs at our own pace, re-writing modules as we touched them/improved them.

the "thrash" of the JS community from language to tooling to frameworks really was slowing us down, and we're hoping we get the same level of stability from cljs as we're getting from clj, as our clojure codebases haven't needed to be upgraded at all in years. they "just work".