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

19

u/Shadowys Jun 23 '23

I dont know who gave advice to beginners to start with graalvm and making decisions, but it definitely seemed like you were taking the wrong advice

Usually for beginners in the clojure language, the common advice is to start with lein and luminus or kit and work your way there. Graalvm is an advanced choice once you’re familiar with the jvm.

4

u/[deleted] Jun 23 '23

Graalvm and babashka were interesting for cli tools.
1-3s startup time is not acceptable when the program itself runs for miliseconds

→ More replies (3)

2

u/Dry-Conflict-7008 Jun 29 '23

I'm thinking about it right now, I spent about 2 months redoing some microservices from the company where I work just using clojure (like training, outside working hours), and every week that passed I felt better and more productive, but the fact that I didn't having a lot of market perspective with clojure, makes me think to stop paying attention and focus on something else.

2

u/[deleted] Jun 29 '23

Go is a language hyper focussed on apis, web backends and cloud stuff.
If those microservices aren't written in go anyway, you should check it out
https://go.dev/solutions/use-cases

29

u/cmiles74 Jun 23 '23

I'm also way unimpressed with the Clojure command line tool. The documentation is weak, the tool is unfriendly, the flags are bizarre. It's a shell script, which also seems like a weird choice. The fact that the Clojure project pushes it so hard is a mystery to me!

4

u/seancorfield Jun 23 '23

Especially that time to hello world needs to get seriously addressed

It took about 27 years for Java to "seriously address" the "time to hello world" (see https://openjdk.org/jeps/445)... and I think Clojure still has it beat:

> clojure -M -e '(println "Hello, World!")'
Hello, World!
> echo '(println "Hello, World!")' > hello.clj
> clojure -M hello.clj
Hello, World!

2

u/[deleted] Jun 24 '23

That's not what is meant by time to hello world as explained in artims talk I linked.
Time to hello world is supposed to refer to the time it takes someone new to the language to install it, open the appropriate editor and run a hello world.

In that regard I'd be highly surprised if clojure beats java, and even if it did beating java isn't much of a goal to aspire.
Beat go, rust, python, javascript or even something functional like haskell and you have yourself a headline.

8

u/seancorfield Jun 24 '23

I've just gone through the top results for "getting started with ..." for each of those and the Clojure experience is pretty much identical (and arguably simpler since both Rust and Haskell expect you to install a language-specific "universal installer" first and then use it to install the compiler, interpreter, etc).

Yes, Clojure requires a JDK to be installed so that is an extra step (unless you use homebrew with the "default" tap, I believe -- the official tap is different and doesn't install a JDK).

You can argue that Clojure-on-Windows is harder -- 95% of Clojure users are either on macOS or Linux (including WSL2 on Windows) -- and hopefully the Windows side will be addressed "officially" soon by the .msi installer that has been developed by the community.

So it's:

  • maybe install a JDK (if you don't have one or don't use brew install clojure)

  • download an installer (shell script or MSI) and run it

  • type clj and start experimenting in the REPL

  • or create hello.clj and run it (as shown above -- deps.edn is optional until you have dependencies, as is creating a src folder).

Most of the languages you point to require a build tool and a compiler and an interpreter and expect you to start by creating a project. You can do that with Clojure but you can get basic scripts up and running without that.

→ More replies (1)

52

u/mauricioszabo Jun 22 '23

Leiningen is a perfectly reasonable tool. The official clojure cli is not.

How I wish more people would figure it out! This is so true, and yet, few people actually talk about this.

Descision fatigue everywhere...

Honestly, I disagree, but I think it's more of a cultural thing than anything else. I used to work with Ruby on Rails, and one of the things that made me quite mad was how every project seemed to start with rails new ... instead of actually using the best libraries for the job. I made a talk about this, when I tried to use a non-Rails approach for a project, and how bad the experience was (because, basically, the acceptable, composable, and fast ORM have 10% of the downloads of the "official Rails ORM", so bugs appeared for very simple things like timezones and differences between Ruby versions).

For me, Clojure was a breath of fresh air of actually putting the decision on what to use on my hands and not on some guys that won the framework race

Finally, I partially agree with ClojureScript - there are really few resources about it, and indeed, we miss a good book on it (specially when you read the re-frame documentation, which spends so much time talking about "dominoes" to the point where I actually miss what they meant...)

2

u/TheLastSock Jun 23 '23

What did you think of this book on clojurescript? https://www.learn-clojurescript.com/

It's the first thing that comes up when i google "clojurescript book" and while i haven't read it cover to cover, the individual sections are seem accurate, concise, well-written, and extremely practical towards the end goal.

3

u/mauricioszabo Jun 23 '23

It's good, but there are still problems on it. The tooling suggestion is not what I would choose (I feel shadow-cljs is better in almost any way than any alternative), and the core.async part is... complicated....

Sure, you can work your way around core.async with ClojureScript, but it's usually more pain than it's worth. It's better to add funcool/promesa and be happy than "fight" the JS ecosystem by converting promises to channels and back (and channels do not map well to callbacks - you will have bugs, or you will have to decide, based on very limited and non-configurable options, how to drop messages).

Also, I'm self-taught in ClojureScript. Since a long time ago, I decided to do a plug-in for the now extinct Atom editor (currently Pulsar editor), and decided to make it in ClojureScript - and because I wanted the best experience possible for ClojureScript, I know a lot of complicated, non-conventional stuff about it... so I'm also "part of the problem" in a way, that I know CLJS but don't know any tutorial, book, and also didn't contribute too much to anything...

15

u/sapphic-chaote Jun 23 '23

I agree with a lot in this post. For as much I love Clojure, it has a lot of rough edges and annoyances, and I am often wondering if Scheme or Racket would be a better fit for me (the answer, to be fair, has usually been "no" up to this point). I love the cli/deps system, but it looks bizarre at first glance and the documentation isn't the clearest (I feel the official clojure material doesn't know if it wants to be a tutorial or a reference sheet, and is hard to google for if you don't already know the terminology— a cost of the command just being "clj" instead of a real name).

14

u/roman01la Jun 23 '23

Love the TL;DR part, it's true, Clojure is far from being a language with a friendly ecosystem DX wise. Unfortunately developer experience gets improved with growth of community, especially when lots of beginners are joining who demand friendlier tools, and they are willing to create those tools.

13

u/seancorfield Jun 23 '23

and they are willing to create those tools.

This is the key point. Most of the experienced Clojure folks have developed very effective workflows based on the existing tooling and don't feel any of the beginner pain, so most of them have no need or incentive to pour time and effort into improving a beginner-DX that they, themselves, will neither use nor benefit from.

9

u/nzlemming Jun 24 '23

so most of them have no need or incentive to pour time and effort into improving a beginner-DX that they, themselves, will neither use nor benefit from.

Unless they want the community to grow, of course.

5

u/seancorfield Jun 24 '23

Right, and why I said "most" not "all". There are indeed some experienced Clojure folks working on improving the beginner-DX, for the long-game benefit of getting more Clojurians into the pool.

11

u/aboy021 Jun 23 '23

I definitely think Clojure could benefit from some sensible defaults with regards to libraries. Discoverability of libraries is still something of an issue, and I'd prefer not to get lost down the rabbit hole of choosing the best tool and not actually building anything.

Sensible defaults would be good for projects too. I love the simplicity of lein new and I wish the official cli had something similar. Easy isn't always a bad thing, especially if it's built out of simple pieces.

I love the theoretical approach of the Clojure command line tools, but the UI is absolutely appalling. Discoverable and readable seem like reasonable goals that wouldn't interfere with functionality.

1

u/TheLastSock Jun 23 '23

Have you compared `lein new` and deps-new?

4

u/aboy021 Jun 23 '23

It's come along since last time I played with it, and it certainly seems like an effective tool.

Unfortunately the syntax is still both ugly and (as far as I can tell) impossible to discover organically:

clojure -Tnew scratch :name play

One thing I love about Clojure is the way I can inspect things, either their own structure or using reflection, to explore what I have and what's possible. Some of the additions to the language and tools over recent years have supercharged those capabilities.

Alas, if I want to create a project, or add a library, there's none of that. I'm left reading documentation and writing barely intelligible arcane commands. I use the fish shell and most cli tools end up being well documented and discoverable through that, but it seems like the syntax choices of the Clojure CLI precent that.

Perhaps what I really want is a REPL for projects, lol.

6

u/radsmith Jun 24 '23

Check out neil. It makes creating new deps.edn-based projects easy. It also has commands to add deps incrementally to your deps.edn with neil dep add and helps you tag new releases with neil version. You can run it in a REPL if you want, but as you can see below, it runs pretty fast in the shell.

$ brew install babashka/brew/neil
$ time neil new scratch play
Creating project from org.corfield.new/scratch in play
neil new scratch play  0.09s user 0.06s system 54% cpu 0.280 total

0

u/TheLastSock Jun 23 '23 edited Jun 23 '23

It's unclear to me whats ugly about it compared to other cli tools, for instance in rails you might have: bin/rails generate scaffold HighScore game:string score:integer

What's hard to discover about it compared to another cli tool? There is a --help command.

If you mean, "it's hard to know what clojure tools" are installed, then i sympathize a bit. You can do that like this:

➜  clj -Ttools list 
TOOL   LIB                              TYPE  VERSION
new    io.github.seancorfield/deps-new  :git  v0.5.2
tools  io.github.clojure/tools.tools    :git  v0.3.0

I feel like that's not obvious from the cli...

Perhaps what I really want is a REPL for projects, lol.

You have that option,the cli tool wraps clojure functions, here is the above above cli function in clojure.

(require '[clojure.tools.deps.tool :as tools])
(tools/list-tools)
;; => ("new" "tools")

12

u/aboy021 Jun 24 '23

This is what I see if I type lein into my shell and hit tab

lein
check                                      (Check syntax and warn on reflection.)
classpath            (Write the classpath of the current project to output-file.)
clean                              (Remove all files from project's target-path.)
compile                               (Compile Clojure source into .class files.)
deploy                               (Build jar and deploy to remote repository.)
deps                                           (Show details about dependencies.)
do                      (Higher-order task to perform other tasks in succession.)
help               (Display a list of tasks or help for a given task or subtask.)
install                        (Install current project to the local repository.)
jar                         (Package up all the project's files into a jar file.)
javac                                                (Compile Java source files.)
light                               (Start a Light Table client for this project)
new                 (Generate scaffolding for a new project based on a template.)
plugin                        (DEPRECATED. Please use the :user profile instead.)
pom                    (Write a pom.xml file to disk for Maven interoperability.)
repl        (Start a repl session either with the current project or standalone.)
retest              (Run only the test namespaces which failed last time around.)
run                                           (Run the project's -main function.)
search                      (Search remote maven repositories for matching jars.)
show-profiles  (List all available profiles or display one if given an argument.)
test                                                   (Run the project's tests.)
trampoline     (Run a task without nesting the project's JVM inside Leiningen's.)
uberjar      (Package up the project files and all dependencies into a jar file.)
update-in                (Perform arbitrary transformations on your project map.)
upgrade                (Upgrade Leiningen to specified version or latest stable.)
version                        (Print version for Leiningen and the current JVM.)
with-profile                (Apply the given task with the profile(s) specified.)

If I want to start a project with Leiningen I can just type:

lein new scratch

Which gives me the convenient message:

Generating a project called scratch based on the 'default' template.
The default template is intended for library projects, not applications.
To see other templates (app, plugin, etc), try `lein help new`.

I can now start interacting with the project by running:

cd scratch
lein repl

Which all seems pretty reasonable.

This is what I see if I type clj into my shell and hit tab:

clj

The man pages and clj --help are nicely written, but after looking at them I still don't know how to create a project.

At the bottom of the page is a reference to https://clojure.org/guides/deps_and_cli so I load that up in my browser. If I read that closely it talks about creating a deps.edn file, and has an example that uses the java-time library. It's still not clear how I create a project and manage dependencies.

The first time things start to get a bit clearer are further down the page in the Using Local Libraries section. There's a text diagram that starts to give you some idea of how to structure a project:

├── time-lib
│   ├── deps.edn
│   └── src
│       └── hello_time.clj
└── hello-world
    ├── deps.edn
    └── src
        └── hello.clj

If you combine that with the command from the previous section (clj -X hello/run) you're starting to get closer to actually building something.

Look, maybe I don't have the right kind of mind for this stuff, or maybe I'm old and lazy and a bit knocked off, I don't think I'm in a position to know for sure. But my experience of the tooling, for what little it's worth, is that it went from being trivial to create a project to being a bit of a pain.

I think ergonomics are important, and for me at least, the state of the tooling isn't very ergonomic at all.

→ More replies (3)

5

u/seancorfield Jun 23 '23

And you can get full help -- from the docstrings -- for any installed tool, e.g.,

clojure -A:deps -Tantq help/doc

clojure -A:deps -Ttools help/doc

5

u/aboy021 Jun 24 '23

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

→ More replies (1)

10

u/RealLordDevien Jun 23 '23

Been working with Clojure for about two years on and off. (successively introducing it into more and more work stuff :D)

The onbording was kind of rough, but doable after i realised that clojure had a different philosophy than other languages.

For a fact, i really enjoy it now, that the clojure ecosystem is so diverse, that there are always a multitute of ways to do things.

Clojure is also a highly stable language, so the need to chase the latest trend and ever changing standard is just unnecessary. If i find a clojure library i like on github, i am often not surprised, when it isnt updated for even years but still works perfectly fine.

Also, there are kind of standards. Most people suggest Reagent for small react wrapping ang re-frame for bigger stuff. (which also just wraps reagent, so its a natural learning curve)

Totally understand the gripe with the tooling. Still using leinigen, because the clojure CLI paramters are just so extremely weird. And getting it to work consistently with code completion in neovim was also a nightmare.

Edit: My main gripe is really the lack of good learning resources. But thats not the fault of the language.

9

u/xela314159 Jun 23 '23

+1 for sticking to leiningen over cli

I have sympathy for the other points but being close to the metal especially with web stuff also gives you extra power

15

u/sherdogger Jun 23 '23

Yah, I'm not surprised given that firehose-drinking introduction. None of these ecosystems are breezy or light; I couldn't imagine trying to do Clojure which further lives atop them without a grounding in Java/JavaScript, functional programming, and just programming in the complex world of modern programming period. TL;DR, I think Clojure is a poor place to start or language to just pick and have a dalliance with...it feels like coming home after everything else, though.

7

u/radsmith Jun 24 '23

I appreciate these posts. For some context, I've been working with Clojure for about six years professionally (and years before that for side-projects). I also contribute to neil sometimes, including adding the neil new command.

On boarding

While Leiningen is a reasonable tool, I'd rather see everyone using tools.deps in the long run. It allows us to build things on top of it with less baggage. For example, we're using a Babashka port of tools.deps to make it easy to install scripts with bbin. I don't think it would have been realistic for me to implement something like bbin on top of Leiningen.

Graalvm & babashka

Babashka is a replacement for Bash. In general users shouldn't need to deal with GraalVM. Everything you need comes from the bb binary.

Web Stuff

I've informally dubbed this the "R Stack": Ring, Reitit, Reagent, and Re-frame. All of these libraries are rock-solid and won't be going anywhere anytime soon. The numerous React wrappers are a symptom of the churn in the React world, not Clojure itself. Even now, React is reinventing itself by making React Server Components the default and it will take some time for the CLJS community to adapt.

If you can get away with not using React, I highly recommend Biff. It uses XTDB and Rum by default but they can be swapped out pretty easily for Postgres and Hiccup and/or Reagent. I'm planning to publish some docs on how to do that when I have a chance.

What to do about it?

When my sister got into programming a few years ago, I wanted to show her Clojure, but I never felt like there was place I could point her to that would make things easy enough for her to start an app from scratch. I can't stand the fact that the number one recommended Clojure book starts off by teaching you emacs. That said, I've been exploring using Biff as the foundation to make the "R Stack" above easier to start with and I hope to share more about that soon.

2

u/KingOfTwos Jun 27 '23

I can't stand the fact that the number one recommended Clojure book starts off by teaching you emacs.

I forget where I read it, but I feel like I saw the author of Brave Clojure mentioning he wished he skipped that and just had them use Calva for simplicity of getting started

19

u/p-himik Jun 23 '23

I'm out.

Even though you seem to be frustrated and have probably unsubscribed from replies to this thread, I'll still provide my own reply in hopes that some other reader will benefit from it.

I understand your position and agree on some points.

However, your overall messages comes from comparing what Clojure has to offer in the broad sense to the best things that other languages have. You also don't compare the best parts of Clojure to relevant parts in other languages. I also won't venture there apart from incidental mentions because otherwise I'd have to write a book.

I'll go point by point where I disagree. And you have mentioned quite a few things, so my reply is proportionally long.

with no one bold enough to clearly mark one as the standard

For good reasons. Imagine you want an ice cream, go to a store, and see only one ice cream. Or there are multiple ones but only one gets all the touting and most of the shelf space. Kinda weird, right?

Some Clojure libraries are in such a position still, but those are very abstract (Ring. Hmm, that actually might be it, at least in my code bases), very niche (xforms, Buddy, Malli, etc.).

Proliferation of libraries is a natural phenomenon caused by two factors: Lisp curse (it's often easier to write something for your own needs than to figure out and adapt something existing) and diverse requirements. The downside is that you now have to choose your dependencies and spend some time doing so. But it's also an upside - your dependencies become a part of your code, even if you don't think about them that way. You have to be very careful when adding a new dependency and when updating an existing one. Lots of tiny libraries make it much easier than if there were a few huge ones (updating HoneySQL is the easiest thing, updating Django/Pandas/Celery/any other huge library/framework is a bloody nightmare, even when it comes to a patch or a minor version).

Every relevant language today just does name build,name run or name install

Apart from Clojure, I know best JavaScript and Python. Used to know others and that knowledge could also be relevant here, but it's probably outdated.

In JS, only the "install" part is easy. But it's also not simple. node_modules is a trash can where everything and anything goes. One day, you can get nested node_modules accompanied by some incredibly hard to debug issues. Unless you're careful with your config, some malicious or just dumb library can erase your home directory during installation. Something like that is simply impossible in Clojure. The "build" and "run" parts in JS still require you jumping through quite a lot of hoops, the largest of which are webpack and Babel. Sure, you can avoid using those, but it comes at a cost of not being able to use the majority of JS libraries.

Now, about Python. It used to be my main and favorite language for a few years. But now I only have expletives towards it, although I'll try to contain myself. In Python, none of the steps are easy. Sure, there's pip. But it's incredibly limited and is suited only for the simplest of things. Dependency resolution in Python is so complicated you must have a way to lock your dependencies to ensure repeatable builds, but pip doesn't offer that. It also uses the global installation location, so you gotta add virtual environments to the mix. Sure, there's Pipenv, but it's a can of worms on its own, on top of which sits (or at least, used to sit) one of the most opinionated tool authors that I have ever seen (issues and PRs used to be closed with only "no" or without any comments at all, it was pretty much "my way or the highway"). Pip and Pipenv with their stubborn deficiencies have lead to a proliferation of alternative dependency tools, some doing everything, some doing just one thing: pex, shiv, cookie cutter, pew, vex, vsh, venv, virtualenv, virtualenvwrapper, pyenv, pyenv-virtualenv (it's almost like a combinatorial explosion at this point), flit, hatch, poetry, pip-tools, pundler. Those are just from my personal 5+ year old notes. Perhaps the situation with Pipenv is now better, but it used to be a wild ride (in the year 2023, is there now finally a way to update just a single dependency, without touching other direct dependencies?). Building a Python package is not easier or simpler than it is for Clojure. While you might say that you don't need to build an app - the same is true for Clojure. I don't build uberjars for my apps, I run them from source with some being deployed as containers because I find that easier for me. As for running - yeah, in Python you can do python script.py or python -m app. In Clojure you have to add an extra single flag, extra three characters: clj -M script.clj or clj -M -m app. But clj is shorter than python by those very 3 characters. ;) Comparing such things is meaningless, akin to comparing how many parentheses different languages have (spoiler: JS often has more parens of all kinds than CLJ).

Adding dependencies in Clojure is a bit more involved in part because it has aliases. In the case of Lein, it has profiles but the order of dependencies also matters there so you always add new dependencies at the bottom. And all that is solvable but I myself wouldn't call it a priority, and seems like that's why it's not there yet. Or perhaps there are design decisions that are not easy to make. Another reason is that both deps.edn and project.clj are not plain lists of dependencies. They allow for all sorts of data and metadata to be there, especially project.clj - adding an extra line to them in a purely automatic way is a trade-off between ease and correctness. In any case, you can use https://github.com/babashka/neil to make your experience more like that with npm or pip.

let's assume that I want to actually build a jar file

Building jars is far from being simple, there are many things to consider. If you search for uberjar in Lein's issues, you'll see that at the moment there are 276 open issues. When a task is fully managed by a tool, you often have no way to work around any such issues. Of course, building a plain jar and building an uberjar are different things, but a lot of problems are similar. With a custom build.clj you are able to overcome any issue on you own, as well as fully customize the build process to your needs.

Cont.

8

u/mm007emko Jun 23 '23

(in the year 2023, is there now finally a way to update just a single dependency, without touching other direct dependencies?)

Unfortunately, not one I know of. I switched from a Java/Spring job to Python 18 months ago and ... never have I ever seen more broken CI/CD pipelines because of transitive dependencies or unstable APIs (this is a problem with people - Python attracts people with no sense of software engineering whatsoever and these people make libraries). You can also encounter stuff either in library or in language itself which does randomly behave differently from everything else (e.g. NumPy expects string parameters instead of enums and guess what happens when they decide to rename the string or PyDantic allow you to use isinstance for straight data classes but not for discriminated unions ... WTF? ... Python and its libraries are not much better than PHP or JavaScript in nature.)

Clojure is not perfect but luckily doesn't share this plague.

16

u/p-himik Jun 23 '23

Graalvm is way more of a mess

Which is the case for other languages if you decide to use Graalvm with them. It is your own doing that you decided to go with a non-trivial tool and had a rough experience. "I decided to go with an experimental C++ compiler but had to rewrite my code to make it work. Therefore, C++ ecosystem is horrendous." - doesn't make a lot of sense, does it?

Python has Flask and Django, Elixir has Phoenix, Ruby has Rails, Go has their standard library

You're comparing apples to oranges and being disingenuous in that you're comparing your existing knowledge to a lack of knowledge. Or at least you make it seem that way since you don't mention that Clojure has Pedestal, Biff, Kit - those are just the ones I could recall on the spot. Python's Flask is merely a server library - it doesn't offer anything else so it cannot be compared to the rest. And in Clojure you use Ring backed by any of the Java or Clojure web servers. Same with Go - it doesn't offer everything a proper web framework usually offers (e.g. seamless DB integration with everything). And Django is a bloody nightmare - apart from numerous bugs that often take years to fix that I myself consider show-stoppers, it's also rigid to such an extent that it's often easier to ditch it completely rather than hammer this square framework into an intricately shaped hole that is your application's domain. I have heard similar things about Rails but I have never used Ruby so can't really comment.

Here I'm supposed to pick all the little components myself and end up with 5-6 different libraries that hopefully synergise?

Why "hopefully"? Unless you're using a macro-heavy library or a library that creates lots of custom data types, you're good to go. And both of those things are quite rare. "It's all just data", so passing a collection from one library's function to another's is as straightforward as it can be. You don't have to create 10 adapters that implement 5 interfaces each, you just pass things around with maybe a bit of massaging in between.

Pick any web server that has an adapter for Ring - and that would be pretty much every single more or less frequently used web server out there. Pick any SQL library. Pick any templating library. Any auth, any image processing, any filesystem, any... anything - it will all work together, a priori. I have been programming for more than half of my life, and more than a third of that has been in Clojure. That's the only time when I haven't had the need to figure out in advance whether something will work together - I simply know that it will, because all the parts are unassuming. Which is entirely not the case with e.g. Django that won't tolerate lots of things you might want to do with your DB directly because it simply doesn't support them and assumes that such things don't exist.

And, as I already mentioned, picking things yourself is usually better than having someone else do that to you. Unless that someone is an expert in their field and is staying within the realm of that field (which is often the case e.g. in cryptography, so you really shouldn't be choosing your own cryptography suite and workflow but rather have some expert do that for you). Quoting https://drewdevault.com/2020/02/06/Dependencies-and-maintainers.html (which I recommend reading in full): "Quit treating open-source projects like a black box that conveniently solves your problem."

The bad part is the assumed domain knowledge.

When in programming do you not need to have domain knowledge? Are there React wrappers in any language that assume that you don't know React? Are there any SQL libraries that assume that you don't know SQL and claim that you can do anything without such knowledge? There might be some things like that that claim that, but you should be very cautious around them. To learn why, read about the history of CORBA. You'll learn a lot about things claiming to be easy and proper solutions for diverse and often underdefined problems. Every useful abstraction is leaky. The only way to not get angry about it is to embrace it and study the underlying domain to a reasonable extent where you can deal with those leaks without having to go for a smoke.

None of them prominently link to a good getting started tutorial.

It might be a subjective thing but I consider http://reagent-project.github.io/ a good tutorial. Of course it doesn't have everything, but that's because it's a tutorial. For more, you can follow https://cljdoc.org/d/reagent/reagent/1.2.0/doc/documentation-index. Both of those links are at the very top of the Reagent's README. Re-frame also has fantastic documentation, although it's more about state management on top of Reagent. Some other libraries are just the thinnest wrappers around React itself, so all you have to do to get the "getting started tutorial experience" is to read a tutorial on React and then read about the tiny API of such a wrapper.

if this language wants to have any hope of becoming relevant outside the FP niche.

...why? Why would a functional language want to become relevant outside of functional programming? I don't dare imagining a world where people would casually do OOP in Clojure. Maybe you meant something else, but if so then I don't quite get that.

4

u/mauricioszabo Jun 23 '23

When a task is fully managed by a tool, you often have no way to work around any such issues

Sure, but in this case you can have the default (lein uberjar) and if that doesn't work, you can add a build.clj and work around the issue by your own - Lein doesn't actually forbid you from doing that, and it is as simple, if not more, than the official Clojure CLI...

2

u/HotSpringsCapybara Jun 23 '23

But clj is shorter than python by those very 3 characters. ;)

I raise you py <tab> script.py and we're even :) It's a silly pursuit of course. It's not about saving a few key strokes or having some kind of visual prejudice (as with parens). It's about discoverability and memorisation.

Ask me how to run a python script, and without knowing the first thing about it I'll probably guess right. What about a python module? Given any prior experience with command line tools, it wouldn't be unreasonable for me to figure that it might be --module or -m. From that point on it will be easy to remember, or just guess.

How about clj then? OK we must add -M. No big deal - it's just two keystrokes. Except what on earth is it in the first place? How about -A? -T? Which one do I use? I don't know. clj itself doesn't like talking about it. Every time I spend some time away from the official tooling, I end up having to Google these things - and they are not terribly searchable. It's not that you won't run into such rough edges in other tools, but they won't be laid bare right at the doorstep.

If it weren't for Neil, I would avoid the Clojure CLI outright. I do appreciate its strengths, but I just find it obscure and primordial in a sense. I doubt it was ever meant as a substitute for Leiningen in the first place, yet that's the perceived community consensus. I pine for a "Leiningen 2" built on top of tools.cli. For the moment Neil appears to be the only player in that space.

5

u/seancorfield Jun 23 '23

-M -- run clojure.main (what follows that are options to clojure.main that it's had for a decade).

-X -- eXecute a function (passing arguments as a hash map)

-T -- run a tool (either an installed tool -- no : -- or use an alias to specify the tool)

-A is kinda the odd one out at this point but since it will stop running clojure.main (at some point, hopefully soon), you could think of it as "select Aliases for a REPL"

11

u/didibus Jun 23 '23

It would probably be nice to have long form names, and maybe drop the dashes altogether, in order to modernize the UX for CLIs. More modern CLI I think adopt this more natural language feel:

clj run <main-opts>
clj execute <function> <arguments>
clj tool <tool>
clj alias ...

It's a minimal change, but I understand people's complaints here. It's software UX at the end of the day, you can adapt to learn whatever UX, but there are clearly some UX that are more intuitive to more people and easier to remember or get to grip with, that's why there's professional UX designers and all that, with case studies and what not. So I'm sure there are better CLI UX our there.

Now, I say that, but also it's difficult to design good UX, and what starts as something that appears better can easily hit issues that make it complicated again. So not saying it's an easy task, just a reality to deal with I think.

3

u/seancorfield Jun 23 '23

It's not that minimal: what about aliases?

clj -M:some:aliases <main-opts>

Remember that clj -M:foo and clj -M :foo have different meanings so you don't want to encourage people to start putting spaces before lists of aliases or they're going to get really confused... so would you then have this:

clj run:some:aliases <main-opts>

People are going to complain about that syntax too.

it's difficult to design good UX

We agree on that. I just don't think it's hard to remember three or four command-line flags that have relatively easy mnemonics for them.

5

u/didibus Jun 23 '23 edited Jun 25 '23

Ya, that's what I meant by eventually you realize there's more challenges to making a better UX.

I'd probably do something like:

clj run -a some -a aliases main <options>

with --alias also available.

Or sometime I see:

clj -a some -a alias run <options>

Where the options to the CLI come before the command so that things after the command are options to the program being launched.

Also supporting a text based options with coercion to Clojure for -X would be nice, quoting EDN in various shell is a huge hurdle.

In the end, I know it's hard to make a better UX, I'm happy to deal with the current UX because I like the functionality and design of the CLI/tools.deps/tools.build.

I do wonder though if it's something to do with being more old school vs new school, commands used to be more minimal, single letter, and people would know how to get to the man page or help and understand how to interpret those.

Personally I've never been able to remember the Clojure CLI commands, and I find them hard to discover since they can't be auto completed. Every single time I need to Google it.

I've just switched to wrapping it all in a BB task instead.

P.S.: And some CLIs nowadays really go the extra mile and even recommend you the right command when you have typos or write a bad command, so the bar is high as well.

3

u/nzlemming Jun 24 '23

I just don't think it's hard to remember three or four command-line flags that have relatively easy mnemonics for them.

I don't agree with this, it's not just the mnemonics but also the semantics that are confusing. I mean, just yesterday, despite years of working with Clojure, I was in Slack asking how to run a build REPL, and it was fairly non-obvious how to do that correctly. I'm trying to figure out at the moment how to make all these options available to a user in Cursive in a way that is easy for a beginner, and it's really tough to do.

Maybe I don't use deps enough, but literally every time I go to do something with it I have to read the doc. It's like git for me in that respect - conceptually simple perhaps, but very hard to use.

→ More replies (2)
→ More replies (2)

1

u/flh13 Jun 24 '23

why is execute a function different from executing clojure.main? Also is tool basically a function?

3

u/seancorfield Jun 24 '23

clojure.main runs like a traditional command line and is passed zero or more plain string arguments.

eXecute runs a single argument function that gets a hash map of key/value pairs, parsed as EDN from the command line.

Both of those execute in the context of your project (paths, dependencies) but tools execute in a separate context (paths is . rather than src, dependencies are just what the tool declares and not what your project runs in).

Hope that helps clarify?

2

u/p-himik Jun 23 '23

Which one do I use? I don't know. clj itself doesn't like talking about it.

Have you tried clj -h? All those flags are described there. And if clj doesn't like something, it'll produce a warning with a clear description.

2

u/HotSpringsCapybara Jun 24 '23

Sure. Just so we're on the same page, allow me to paste a snippet:

Usage:
 Start a REPL  clj     [clj-opt*] [-Aaliases]
 Exec fn(s)    clojure [clj-opt*] -X[aliases] [a/fn*] [kpath v]*
 Run main      clojure [clj-opt*] -M[aliases] [init-opt*] [main-opt] [arg*]
 Run tool      clojure [clj-opt*] -T[name|aliases] a/fn [kpath v] kv-map?
 Prepare       clojure [clj-opt*] -P [other exec opts]

Maybe I'm just dim, but the only one of these that I consider self-explanatory is -X. -M is downright abstract and I strongly suspect it's some Java detritus. That -T would stand for tool is natural, but then that also relies on some contextual knowledge, namely: what qualifies as a tool and what running a tool entails. This information isn't exactly front and centre. To be clear: I'm not saying it's not there. The official page does cover it in the tools.build section.

Moving past the surface-level inconveniences, what you get is several ways to run code. Why and when you'd choose one mode over the other requires a degree of understanding. Once you educate yourself, you can... proceed to design your process from the ground up. That's what you're expected to do, because this is an expert tool. Except as I wrote earlier - that's now how it's positioned, and I think that's the crux of the whole thing. Leiningen gives you a set of reasonable defaults that cover typical needs and typical scenarios, with an option to produce a bespoke process. Clojure CLI does the exact opposite, except it doesn't even bother with the defaults. That's far cry from your go build and your go test. I hope you get my meaning.

2

u/p-himik Jun 24 '23

And all those options are explained right below that "Usage" section. Unless, perhaps, your clj installation is greatly outdated.

exec-opts:
 -Aaliases      Use concatenated aliases to modify classpath
 -X[aliases]    Use concatenated aliases to modify classpath or supply exec fn/args
 -T[toolname|aliases]  Invoke tool by name or via aliases ala -X
 -M[aliases]    Use concatenated aliases to modify classpath or supply main opts
 -P             Prepare deps - download libs, cache classpath, but don't exec

clj-opts:
 -Jopt          Pass opt through in java_opts, ex: -J-Xmx512m
 -Sdeps EDN     Deps data to use as the last deps file to be merged
 -Spath         Compute classpath and echo to stdout only
 -Stree         Print dependency tree
 -Scp CP        Do NOT compute or cache classpath, use this one instead
 -Srepro        Ignore the ~/.clojure/deps.edn config file
 -Sforce        Force recomputation of the classpath (don't use the cache)
 -Sverbose      Print important path info to console
 -Sdescribe     Print environment and command parsing info as data
 -Sthreads      Set specific number of download threads
 -Strace        Write a trace.edn file that traces deps expansion
 --             Stop parsing dep options and pass remaining arguments to clojure.main
 --version      Print the version to stdout and exit
 -version       Print the version to stderr and exit

init-opt:
 -i, --init path     Load a file or resource
 -e, --eval string   Eval exprs in string; print non-nil values
 --report target     Report uncaught exception to "file" (default), "stderr", or "none"

main-opt:
 -m, --main ns-name  Call the -main function from namespace w/args
 -r, --repl          Run a repl
 path                Run a script from a file or resource
 -                   Run a script from standard input
 -h, -?, --help      Print this help message and exit

12

u/joinr Jun 23 '23 edited Jun 23 '23

In clojurescript there are about a dozen react wrappers. None of them prominently link to a good getting started tutorial.

https://reagent-project.github.io/

https://day8.github.io/re-frame/re-frame/

It's like the clojurescript guy is supposed to already have extensive experience in js before starting.

It's a hosted language that lets you leverage what's there (in many cases through idiomatic community-made wrappers), but you are exposed to the broader ecosystem (which you get to have and interop with). I think this is a misplaced grievance; more an indictment of webdev in general.

I came from clojure -> cljs -> osmotically learning JS out of interop needs (not unlike how I picked up Java along the way with Clojure). The webdev experience added an order of magnitude more difficulty because of 3 languages to pickup, and never ending churn of libraries. I found that CLJS (for the most part) helped manage a lot of the jank for me, and helped paper over some of the brittle foundations in JS land; at least enough to deliver some analytic products.

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

https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/

Costs money, but the author's gotta eat.

12

u/halgari Jun 23 '23

I used Clojure for about 10 years, and agree completely with this. Clojure has some nice benefits, but moving back to C# it's so nice when my tools "just work". IDEs like Rider may be heavier than Emacs or Vim, but they are also so heavily integrated that everything you need has probably had 100 other people do it before you.

There's no choice paralasis in other langauges like C# because there's about 3 choices, one of which is endorsed by MS or some other company pouring millions into the development. Testing libraries, dependency management, etc are all solved just by the sheer number of people using the language on a daily basis. Even stuff like Async/Await is more advanced than the Clojure versions (which have all been abandoned for several years).

The other thing I've really come to appricate in C# is how easy it is get code running fast. With a bit of tweaking you can easily get withing "spitting distance" of C performance. Stack allocation, spans (memory safe pointers), past by value, even SSE/AVX optimization is within reach. But on the JVM everything is so abstracted it's often hard to hint through the Clojure compiler and through the JVM what it is your really want done.

To be honest, what reailly made me switch though was I write desktop software now, not webapps. And I write open source software. So I need a language that's easy to pick up, starts quickly (doesn't have a long warmup time), doesn't overallocate system memory (we need to play nice on user's machines with 8-12GB of memory), and yet has enough optimization headroom to be fast and efficient. For Open source work, I need a language that's commonly used, and can be easily picked up by hobbiest. Also since this is a desktop app I need something that has a solid UI toolkit. Sadly the JVM fails in almost every one of those areas, and Clojure being so closely tied to it also fails to meet the requirements.

I love what I learned in Clojure, and I wish some of the metaprogramming stuff could make it onto .NET, but so far I haven't really run into anything that Clojure does that C# can't do, and frankly do in a much more standardized and clean manner.

I ran into this recently: https://www.youtube.com/watch?v=SGBuBSXdtLY a video where some language enthusiests see/read Clojure for the first time. I forgot how dense Clojure was, and also how lost new users feel the first time they look at it. I think that's why some languages like C#, Go are taking off the way they are. Sure they're more verbose, but sometimes that results in code that's less daunting to read and work with. I kindof forgot how many syntax rules Clojure had. Stuff like `&` `:as` and `cond` may be "just data", but they're also syntax and these days Clojure sure has a ton of syntax.

2

u/mumbo1134 Jun 12 '24 edited Jun 13 '24

Oh fuck, I just found this comment. Aren't you who did the presentations on core.async that are linked on that repo's github? Those were so good, literally the only way my ogre brain could understand those constructs. I am so floored to hear you bounced after seeing how knowledgeable you were about the language. I've been grappling with the same concerns articulated in this thread.

10

u/seancorfield Jun 23 '23

Being able to compile to both the jvm and javascript is a unique trait that no other language I'm aware of has.

It's far from unique these days.

5

u/eeemax Jun 23 '23

I’ve found that if you stick to: Ring/Compojure + Reagent it’s very easy to ramp up, and web development is a breeze.

I find reagent even easier to learn than vanilla react. That library is truly a work of art.

I think ecosystem fatigue is a real thing, but it also sounds like you used a whole bunch of tools that you didn’t need to. Did you like lein? stick with lein. everybody uses it, and you don’t need anything else except to run cljs compile commands.

2

u/eeemax Jun 23 '23

also this book (I think I read an earlier edition?) was crispy (a good intro to the language).

https://www.amazon.com/dp/1680502468/ref=cm_sw_r_cp_ep_dp_GKzJAb11S07VA

5

u/IllTennis8912 Jun 23 '23

I actually think the 'web stuff' is quiet mature and one of the strong suite of clojure ecosystem after all those years and many elegant libraries. There's no one big framework as RoR, instead you hand pick a few Swiss knife library kits and you're good to go. That's the fun part of doing web in clojure and it's simple and elegant, most importly, you know what you're doing with your choices made.

I cannot agree with you more about the official clojure cli. Never have I ever used a cli tool whose UX is so poorly designed. Almost every once in a while I have to go through the whole deps and cli guide page to remind me of all those bizarre syntax with -X -M -A, it's hard to remember and hard to get right.

5

u/halgari Jun 23 '23 edited Jun 24 '23

The problem with the "hand picked options" is that you're now in a situation where every little decision you make in your project has about 4 options, and you'll spend quite some time evaluating them to pick the right one for your current project. Then often there's some oversight that means that those projects don't work for your specific needs, so you have to use something less standard or sometimes roll your own.

When doing Clojure professionally we ran into this all the time. The most commonly used Redis client (carmine) assumed you wanted to use a clojure specific serialization library (Nippy) so you had to turn that off. It also hid several settings that made it hard to understand if the client was configured in the correct state. We ended up ripping most of that out and using something like a Java API, or avoiding 99% of the library and working at a lower level.

Same thing has happend to us with SQL libraries, we eventually just started calling the PSQL Java clients, because every wrapper in Clojure had some sort of problem that the hobbist developer hadn't though of.

And we can continue this for Logging libraries, HTTP libraries, etc. I once spent a week debugging a strange error that came down to how Ring calculates compressed header sizes when you hand it already compressed responses. Most of the companies I worked for in my 10 years had large amounts of hand rolled code for common things like security, interop, etc. Because none of the available options were robust enough to work at scale. I worked with this team for awhile (https://www.youtube.com/watch?v=av9Xi6CNqq4) and we actively worked to never use Clojure interop for this exact reason, as it often ended creating more problems instead of solving them. Instead we worked with the much more mature JVM libraries that were often created by the DB vendor themselves.

And let's not forget that the only reason Pedestal exists is because Ring didn't handle async responses in a way that worked for larger projects. (at the time you couldn't have async handlers, iirc).

2

u/seancorfield Jun 23 '23

Same thing has happend to us with SQL libraries, we eventually just started calling the PSQL Java clients, because every wrapper in Clojure had some sort of problem that the hobbist developer hadn't though of.

Should I be insulted by that, as the maintainer of clojure.java.jdbc and next.jdbc? I don't recall you raising issues with either library about problems...

(I share your grousing about Carmine... we switched to Redisson and then plain ol' Jedis with our own connection pool logic built on top).

3

u/halgari Jun 23 '23

No, and IIRC we moved *to* clojure.java.jdbc. It's just in the past we tried HugSQL, demoed HoneySQL (iirc), and originally used Korma. What we ended up doing was just using JDBC (through your lib IIRC) and coding all our queries as strings, and using varargs as the parameters. Essentially doing:

```
(query db "select * from users where name = %" user-name)

```
The `query` function would return a seq of maps, and all that, but aside from that. We had variants for calling queries that returned scalars etc. But IIRC all of that was just a thin wrapper over clojure.java.jdbc. What we were really trying to get around was the insanity of Korma, and didn't see a reason to use HoneySQL or HugSQL over 2-3 functions that just did the most basic thing.

→ More replies (3)

9

u/rpd9803 Jun 23 '23

I never thought of writing breakup posts with previous languages, I owe /r/php /r/hypertalk /r/xquery /r/java /r/javscript /r/typescript and /r/lua some breakup posts... and thanks to /u/borkdude I can also write one to /r/bashscripting :) (editors note: those subreddits may or may not actually exist)

As for throwing away the language because the ecosystem is bad, I can understand the compulsion. But I'm not giving up on the cake because I don't like the plate, as eating bad cake is far worse than enduring a bad plate.. but maybe my perspective only comes after eating a lot of cake off a lot of plates, and even having to eat some cake without a plate at all.

1

u/Herman_Melville55 Jun 23 '23

What language are you currently seeing?

5

u/rpd9803 Jun 23 '23

Clojure is the best cake 🎂 🤤

1

u/HotSpringsCapybara Jun 23 '23

You jest, but I'm confident these communities (real or not) would appreciate your feedback.

4

u/[deleted] Jun 23 '23

I recently started a ClojureScript project and I didn't find the official quickstart to be helpful.

  • Commands such as cljs.main --repl-opts "{:launch-browser false}" --compile hello-world.core --repl felt confusing. People are used to npm run dev, I can't imagine devs typing all that just to start a dev server.

  • The Quick Start doesn't mention Leiningen at any moment, but then the first link on the Project Templates page goes to a Leiningen project

  • The recommended project template also felt quite abandoned.

  • After quite some time, I figured out that I should follow the Shadow CLJS guide instead of the official docs.

Just as a comparison, this is the VueJS quickstart: https://vuejs.org/guide/quick-start.html#creating-a-vue-application

5

u/mauricioszabo Jun 23 '23

Try the Shadow-CLJS documentation - it's way better, and shadow is basically better in any way I can imagine than the official tool anyway :)

4

u/agile-is-what Jun 23 '23

I recommend people just start with Babashka or nbb. The very easy to install and use, comes with great documentation and batteries built in. And you are not locked in to them, I had to switch away from babashka for a project and just printed out the deps and started a new depa.end file.

6

u/agumonkey Jun 23 '23

It's an interesting issue. The reasons seems to be human, social and paradigmatic. Note that I'm not in contact much with the clojure world these days, so these are old personal opinions :)

  • clojure was pure function / dsl / libs first, to avoid coupling, but this means lots of tiny libs to compose

  • the social mass is low, django, flask etc happen through the need of large bodies to structure around a few ways, clojure and lisps.. less so

  • lisp, culturally, favors the crazy hacker which also taps in the previous issue. not saying people are all loners, but i'm not surprised by the above issues, the tendency to have more small distributed efforts vs a few big players.

I love lisp, I love fp, I liked clojure a lot but never found the right soil to grow in, strangely I use python, with all its limitations, also due to social forces .. and job market forces. It's easier to invest long term when you're paid for it.

3

u/Apprehensive-Lie5750 Jul 09 '23

Surprised nobody mentioned https://practical.li/. Great and... practical (duh) learning resource for all Clojure

5

u/[deleted] Jun 23 '23

Hi OP, I'm also a Clojure newbie and I have more or less the same experience/time with Clojure as you.

I find Clojure a beautiful language and the ecosystem is just fine, at this time we have plenty of mature options for doing a lot of stuff, and as a Java developer I can always fallback to Java when I need. I will make comments on your points:

  • Project Management

You are not enforced to use the new deps.edn stuff. No one is point a gun at your head when you are at home creating a new project. I use leiningen all the time, I'm getting good at it and I don't want to learn something new now for no reason.

  • Graalvm & babashka

Many libraries aren't ready for graalvm yet so you should expect a lot of headaches if you try to compile a Clojure application as a graalvm binary. The JVM is perfectly fine and it is the best runtime to run Clojure applications.

I'm a Java developer myself and even with Java you can have a hard time porting/developing something to this runtime, because a lot from Java ecosystem uses reflection bullshit and other stuff that isn't compatible with Graal's philosophy.

Babashka is a different story, it uses a different interpreter and as far as I know it is intended for small scripts you would use bash for. There isn't too much to think about it.

  • Web Stuff

I also had decision fatigue even with Python, had a hard time deciding between Django x Flask x Fast API. Clojure web stuff is just more fine grained, what worked for me was having someone else to decide for me what to use, and that means using the Luminus stack. All libraries used in the Luminus stack are completely fine and get the job done.

You can also benefit from Eric Normand's guides. The guy is a passionate Clojure developer and committed to help newbies like us to avoid mistakes in the learning process.

https://ericnormand.me/mini-guide/what-web-framework-should-i-use-in-clojure

https://ericnormand.me/mini-guide/clojure-routers

2

u/[deleted] Aug 21 '24

Literally a dozen languages can be compiled to Javascript. The fact you don't know that tells me I shouldn't care about your opinion.

0

u/didibus Jun 23 '23

Every relevant language today just does name build,name run or name install

Not Java, and unfortunately that was the inspiration for the CLI UX it seems.

I think from reading your post, it's unclear to me if you used Clojure for serious work, big information systems, full backend APis, and full-fledge complex websites or web apps?

For simple cases, the added power, modularity, and flexibility will appear as negatives as they make things less easy.

Could we have both, probably, but the core team only focuses on the more enterprise concerns.

Lastly, these posts are never very useful. If nobody stays around to put the work into addressing the issues they've had, it creates a chicken and egg. So who is this feedback for? In general I find these posts only creates animosity and serve to put off onlookers, or are used later in silly language wars.

Instead of writing this, here's some ideas:

  1. Create well detailed issues to the relevant projects. Do more than complain, show that you've thought about how to improve things and considered at least a few of the challenges, edge cases and trade offs involved.

  2. Write a guide/tutorial and post it somewhere, forum, stack overflow, your blog, etc.

  3. Make a PR to official wikis or docs

  4. Build the tooling you're missing and open source it and maintain it for years to come

  5. Contribute high quality PRs to existing tooling and projects

  6. Hangout on forums and chat boards and help others with their issues

  7. Publish video content that teaches others how to do things

6

u/[deleted] Jun 24 '23 edited Jun 24 '23

Why instead?
1.) I have created ~10 issues that I put thought into
2.) I have written a post 6 months into clojure on my blog (link) (admittedly a mixed review)
3.) I have added examples do clojuredocs.org and made a PR to clj-easy
4.) I had a github template repo for clojure project initialization
5.) Not a PR, but I became hickory contributor to fix the graalvm incompatibility (link)
6. & 7.) No thanks!
I don't consider myself a new user or an incompetent programmer.

2

u/didibus Jun 25 '23 edited Jun 25 '23

That's great! Thanks for actually trying to make things better.

Complaining and venting dissatisfaction is fun sometimes, and it can help deal with your frustrations, but in general I haven't seen it really result in anything positive for the language or community.

Your blog post I've found much better, because you've contextualized that you're more of a sysadmin and have particular needs that maybe aren't the strength of the platforms Clojure runs on.

2

u/[deleted] Jun 24 '23

For simple cases, the added power, modularity, and flexibility will appear as negatives as they make things less easy.

Then why would it be bad to put off onlookers that aim to write small / simple hobby projects?

1

u/didibus Jun 25 '23 edited Jun 25 '23

Clojure is still great for small and simple hobby projects.

I said that it isn't as easy, it will still be simple and elegant, and if you can get over that, say because you're an experienced programmer already, or are willing to spend the time/effort as a learning exercise, it will be great for small and hobby projects as well.

10

u/halgari Jun 24 '23 edited Jun 24 '23

Replies like this frustrate me a bit, because it shuts down conversation that needs to be done:

Create well detailed issues to the relevant projects. Do more than complain, show that you've thought about how to improve things and considered at least a few of the challenges, edge cases and trade offs involved.

Tried that for many years, it always gets held up in bikeshedding. I once fixed something in Clojure and it took it so long to get approved I was shocked to see my name in the changelog. I had to go dig up the code to see what it was I had contributed. Turns out it took about 2 years from when I wrote it to when it landed in master. When I brought it up once I became the posterchild for "what's wrong with open source" (https://gist.github.com/richhickey/1563cddea1002958f96e7ba9519972d9)

Write a guide/tutorial and post it somewhere, forum, stack overflow, your blog, etc.

Doesn't fix the problem, just teaches people to accept the sharp edges and do nothing about it.

Make a PR to official wikis or docs

Clojure doesn't accept PRs

Build the tooling you're missing and open source it and maintain it for years to come

Great, instead of X kindof-okay solutions, now we have X+1

Contribute high quality PRs to existing tooling and projects

How is a new user supposed to create "high quality" PRs? Until that happens are the new users (like OP) supposed to just suffer? In my time in Clojure I saw many times when people said "why can't we do X" and they got some long reply about how that was against the Clojure spirit, ideals, or something like that and told to go off and build it on their own, further fragmenting the community.

Hangout on forums and chat boards and help others with their issues

So a support group of people trying to figure out how to deal with things?

Publish video content that teaches others how to do things

So if you don't understand how something works you should start teaching others?

OP had a bad experience and lended some nice feedback, a "exit interview" if you were, and your reply is essentially "stop complaining all the problems are with you"

1

u/seancorfield Jun 24 '23

I'm curious, is there a reason you linked to the fork of Rich's gist that has no comments, rather than the original that has a lot of comments supporting Rich's position?

4

u/halgari Jun 24 '23

Just a mistake, I didn't have the link handy so I googled the title, clicked it, and copied the link once I saw it was the article I remembered. I'll update it. Maybe I should also have linked my original post which wasn't a critique as much as a statement of fact. Stu had one bit of feedback about the terms I used one sentence but aside from that backed up what I said at the time.

https://gist.github.com/halgari/c17f378718cbd2fd82324002133ef678

6

u/seancorfield Jun 24 '23

Yup, change is slow in the Clojure world. I've been very active with Clojure projects for a dozen years now and I've had one very minor change accepted into core. And that's fine. I've used Clojure in production for those dozen years and mostly adopted alphas and betas as they've become available because I can rely on it being so stable -- because Rich et al are so conservative about change.

There are a lot of things I'd like to change but what we have is awesome already so they're "nice to have" rather than blockers.

When there is a blocker -- as we recently encountered with 1.12 Alphas -- the core team takes it very seriously and spends a huge amount of time working with the affected party, debugging the issue, and figuring out the best possible approach. We haven't been able to use 1.12 Alpha in production yet -- the first time for many releases -- but we know the fix is coming in Alpha 4 and I guarantee we'll have that in production a.s.a.p. once it drops.

I've worked in open source for about thirty years at this point. There are always people complaining that their change didn't get accepted or that their "critical" feature request got denied. That's just how OSS works. Some people make a giant fuss about it. Some people even quit the community in a big, showy, temper tantrum. Others accept that not everything goes their way and just move on and continue using the great OSS project they have today.

I've also made a "giant fuss" about my feature requests getting turned down -- in multiple OSS communities over the decades -- but mostly I just get on with using stuff and building what I need. Yes, occasionally it's enough that I feel I have to change tech stacks -- that's happened just once in 40+ years so... very occasionally --- but mostly, I just grumble and keep on with it, as long as it's bringing me value.

Clojure brings me a lot of value.

-1

u/didibus Jun 25 '23 edited Jun 25 '23

I appreciate your previous contributions, like the patch you worked on, which ultimately had a positive impact, despite the lengthy process it took to be implemented. You've sinced switched more to voicing complaints rather than actively contributing, and I'm genuinely curious about what you hope to achieve by persistently expressing dissatisfaction and frustration with Clojure. I have yet to see such complaints, no matter who it's coming from, have any positive impact.

it shuts down conversation that needs to be done

I feel this conversation has been had every year from almost the day Clojure became public. It seems like a tradition that someone comes and mentions how it's not easy enough, and there are idocincracies that if only would be changed then they'd stick around, but have to unfortunately leave to Python or Go instead because of them. And yet another year go by, and nothing is easier, and the idiocinciracies are still there, because the Clojure authors say that's how they like it, or that they don't have the time to address those and have different priorities, and that Rich Hickey wants to review everything, etc.

Which is why I'm genuinely curious, who do you want to have this conversation with, what do you expect to come out of it, why do you feel it needs to happen again and again?

4

u/JickRamesMitch Jun 23 '23

we will be happy to have you in r/elixir 🤠

2

u/mm007emko Jun 23 '23

Why the downvotes? I mean ... I don't know much about Elixir or Erlang, is there anything wrong with them?

4

u/didibus Jun 23 '23

Because it's opportunistic and back handed, it reinforces silly language wars, and it pitches the communities against each other.

Elixir is a good language, which took a lot of inspirations from Clojure, I quite like it, one of my fav along with Clojure, the comment though was deserving of downvote.

3

u/andyleclair Jun 23 '23

I came here to post the same thing! I've been writing Elixir as my day job for about 6 years now and I never want to use any other language

3

u/JickRamesMitch Jun 23 '23

maybe you should come too

2

u/mm007emko Jun 23 '23

I just looked at the guides at Elixir website. It sounds interesting, I'll give it a try during this summer season.

3

u/JickRamesMitch Jun 23 '23

check out the end of this interview the creator of elixir does a live demo https://www.twitch.tv/videos/1847750304?t=1h54m8s if you like that the rest of it is worth watching too

1

u/morbidmerve Jul 12 '25 edited Jul 12 '25

imma be honest i dont understand the decision to leave the ecosystem at all. in the JS ecosytem, none of these things you complain about were solved out of the box. a huge amount of money was poured into this and it resulted in insanely fast iteration of dependency API's, frameworks and different approaches to the same server-client contract space. there was a huge amount of time and sponsorship put in to this. clojure simply doesnt have that backing because the people investing time in it tend to not need those frameworks in order to be productive.

you dont like that there arent good onboarding docs? MAKE SOME
you want to mark dependencies as the true standard? MAKE A LIST AND SHARE IT
you dont like that people dont put there opinions forward shamelessly? go to clojurians slack and ask them their opinion.

e.g. clojure has no Next.js . it COULD have, but we can not compare an ecosystem of open source contributors to an ecosystem where millions of dollars have been invested. back in 2018 reagent was a thing, but it didnt keep up with the react ecosystems (for reasons mentioned above).

in terms of react support, clojure has shadow-cljs that can compile cljs to node from jvm clojure, which can be used to set up ssr and client hydration. There is also UIX which is an excellent wrapper around react. and yes you do need to understand these things in order to use them effectively. the fact that you dont have to do this in other ecosystems doesn't lead to any serious benefit other than churn speed. but more instances != better instances. most of these apps dont even see 1000 + users ever and have a lifetime of less than 5 years because those building them never get past learning how to build a login screen. it takes a similar amount of time to learn to be effective in those universes as it does in clojure. clojure is just harder and less forgiving.

these arguments, to me, just sound like you could put together a very simple to use stack for yourself, but instead you want it to be easy to do out of the box. but the thing is, simple isn't easy if the work hasn't been done. in other ecosystems, that work has already been done, but the approach didnt lead to better software, it lead to easier software. if you are looking for easy software, then yes, clojure is not the right place to be. but most of the time you need simple, not easy. it eventually becomes easy when you put in the work to figure out how things COULD fit together, and then improve it consistently for years. eventually, you end up with some wins, and the ecosystems and frameworks you are referencing are good examples of that.

P.S. I am by no means saying that the current experience is GOOD. im in fact agreeing that it sucks, but it will keep sucking until you just build the proverbial NextJS with SSR support for jvm clojure and make the community aware of it. bowing out before that is equivalent to saying "i want the benefits but i dont want to do the work". not saying thats your take, but that is how it can come across. none of us "want" to be the devs that first built react (everyone always has an opinion) but we all want the convenience of having it.

1

u/seymores Jun 23 '23

Thanks for speaking on this, especially the encouragement of the cli over lein.

-4

u/Sea-Run3782 Jun 23 '23

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

These exist. It is not hypothetical. Most of the time though, reading the actual library code tells you what you need.

After spending 3 years toughing it out without a CS/Software Engineering degree & trying to get into the industry entirely on the back of Clojure & the holistic understanding it demands of the user, it's kinda shocking how many people fresh out of university feel the need to make these kind of complaints that demonstrate they haven't really been engaging with the community. Instead of just asking for for guidance 6 months before making the post.

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.

lol, lmao even.

So every once in a while I might want to write a program that doesn't take >1s to start

Did you consider for a moment, the complexity class of JVM Clojure applications & how they behave at scale? Go make a coffee while the REPL starts, grasshopper.

Or better still, google for the right tool for the job:

https://github.com/jank-lang/jank

Here I'm supposed to pick all the little components myself and end up with 5-6 different libraries that hopefully synergise

Welcome to Libertarian Programming. Gerry Sussman says Hi, apologises for not being able to provide guarantees but hopes you will appreciate the flexibility.

3

u/[deleted] Jun 23 '23

Ah yes, finally the elitist arrives.
Not sure you could have stated your disagreement more rudely.

3

u/TheLastSock Jun 23 '23

Have you read or used Jank extensively? Last i checked it was still very much a work in progress.