r/Clojure • • Jun 22 '23

Leaving Clojure - Feedback for those that care

After having written several small projects over the past 9 months I'm leaving this language and want to outline some reasons for that decision such that anyone inclined can work towards bettering this ecosystem.Long post incoming.

The Appeal

In August '22 I spent a month doing haskell after I got a recommendation by a professor.I was also already using emacs since January of that year.I enjoyed functional programming and was just familiar enough with the paradigm as well as the best supported editor to give it a shot.Highlights of the coming months would be the strong support for higher order pipelines through the ->> operator, as well as the well thought out core data structures, especially maps.Another big appeal was the premise of "write clojure everywhere".

On boarding

Initial on boarding with "Clojure for the brave and the true" was fine-ish.Definitely not as great as official resources from other languages such as the official python tutorial, the go tour or the rust book.But at the same time no worse than introductions to comparable languages, such as "Learn you a Haskell"

Going from the first few lines to the first few projects was okay-ish as well.Leiningen was well documented and introduced and libraries for most tasks exist.Some domains have several available libraries with no one bold enough to clearly mark one as the standard.This meant it took me a bit longer than it should to land on hickory for my html parser and cheshire for json, but it's fine in the grand scheme of things.

At some point I wanted to migrate to the official clojure cli.That experience was very rough and I'll go more into some details in the following section, but for now I must cite lack of well written tutorial / walk-through style documentation and lack of coherency.

Project Management

Leiningen is a perfectly reasonable tool. The official clojure cli is not.Every relevant language today just does name build,name run or name install where you replace name with the tool name.Now fasten your seat belts for the official way to run a clojure program: clj -M -m my-code.coreBut let's assume that I want to actually build a jar file, I now have to:

  1. add tools.build to my dependencies

  2. write a whole build.clj file

  3. add an alias to my deps.edn for actually building

Graalvm & babashka

So every once in a while I might want to write a program that doesn't take >1s to start.Both tools are probably about as good as they can reasonably be, given their ecosystem.Both are far from a drop-in replacement.

With babashka it's not too bad. Sure, many libraries aren't supported, but that's to no fault of borkdude. Not much needs to be rewritten and the things that do are not too painful.In an ideal case I wouldn't have to rewrite and could just choose it as my clojure implementation of choice, but it's tolerable.

Graalvm is way more of a mess. It took me weeks of occasional tinkering to get my application (a small cli youtube client) working with graalvm native image. If I hadn't accidentally used an older hickory version it probably would have never worked. I went on to go into the hickory codebase and bisect for the error, and at some point got contribution rights to hickory to upstream those changes. I also documented the issues for the next guy.Terrible experience.

Web Stuff

Clojure is supposed to be the best lisp for the web, the best functional language for the web even.Being able to compile to both the jvm and javascript is a unique trait that no other language I'm aware of has.Yet, after getting motivated to pursue a small web application, I was totally put off.

Descision fatigue everywhere, in fact decision fatigue that is only matched by the incredible churn in the javascript ecosystem. Python has Flask and Django, Elixir has Phoenix, Ruby has Rails, Go has their standard library.Here I'm supposed to pick all the little components myself and end up with 5-6 different libraries that hopefully synergise? No thanks.

And that isn't even the bad part, that's merely a non-strengh. The bad part is the assumed domain knowledge. In clojurescript there are about a dozen react wrappers. None of them prominently link to a good getting started tutorial. It's like the clojurescript guy is supposed to already have extensive experience in js before starting. The backend is only marginally better tbh.

In some hypothetical ideal clojure ecosystem there would be reagent, compojure and a nice, open source book written about each of them.

What to do about it?

Thankfully, there already exists a great talk on the matter that I do agree with: "How to Increase Clojure Awareness" by Artem Bramin at clojureU 2022 (link)
Especially that time to hello world needs to get seriously addressed if this language wants to have any hope of becoming relevant outside the FP niche.

tldr: Clojure is a beautiful language in a horrendous ecosystem. I'm out.

98 Upvotes

102 comments sorted by

View all comments

Show parent comments

5

u/aboy021 Jun 24 '23

A useful tip, thank you. I do wish it were a bit more convenient.

4

u/seancorfield Jun 24 '23

Yes, even I have to think about that particular invocation :)