Live data from Hacker News

Ask HN: Is Clojure Dead?

news.ycombinator.com

131–140 of 145 posts

Re: Ask HN: Is Clojure Dead?

#131
post #35

Clojure is a wonderful language, but not so wonderful that I can tolerate its slow startup and compile times. I think lots of developers think the same way. Imo any language nit facilitating fast startup and compile is stillborn. Imo the same goes for any language requiring you to setup a "project" or something to get started.

Slow compile times? You don't even need to compile Clojure to run it.

It only has slow start time, but since you work at an always connected REPL, it's pretty much instantanuous throughout your entire work day. Start it in the morning (takes a few seconds at most), and then it's instant feedback until you clock out.

And for slow start time for deployment use cases that need fast start time, like CLIs, scripts, serverless, you can either use babashka, Clojurescript, or compile Clojure to native using GraalVM.

Re: Ask HN: Is Clojure Dead?

#132
post #121

Earlier quoted context omitted.

> but there are still tons of situations where you want a full recompile and restart What situations specifically? In my career as a Clojure/Script developer, making servers, desktop UIs, frontends, CLIs, almost anything, I've never had that requirement. So I'm a bit curious of when that would be required.

When you mess up the repl session somehow, for example by starting a http server on a port but not storing the server object. You now have blocked a port, and restarting the server does not work. Or if you run something like (future (while true ...)) There is some wierdness when redefining protocols and multimethods where a good 'ol restart is the easiest way to set things right. Try working in an ecosystem with fast…

> When you mess up the repl session somehow, for example by starting a http server on a port but not storing the server object. You now have blocked a port, and restarting the server does not work. Or if you run something like (future (while true ...))

That's true, but how often do you end up in those cases? I usually end up with those one time per project, if it happens at all. Once solved, you won't hit it again. Once you know what can hang a REPL session or block a port you want, you usually don't hit those issues again.

> Try working in an ecosystem with fast compile and startup and you will see why it is an advantage

I have, Clojure is not my first nor last programming language I've learnt. Even working with language that has no compile step at all (interpreted languages), being able to edit the program in real-time is still preferably for me, as it's much easier to iteratively come up with solutions.

But of course, not all approaches are suitable for everyone, to each their own, etc etc.

Re: Ask HN: Is Clojure Dead?

#133
post #113

Earlier quoted context omitted.

I'm very familiar with the live editing aspect of Clojure, and I like it a lot actually. What I am saying is that Clojure's long startup time is still annoying if you want to restart, for example if you trashed your repl session or want to start with a clean slate. If Clojure would start fast enough it could also be used for CLI scripts and we would not need Babashka at all. All in all, I think Clojure is a great lan…

Wait, how slow is it starting for you? On my 2012 Mac Mini, a clean clj 1.11 REPL (with no namespaces loaded) starts in under 5 seconds (using JDK 18).

No namespaces loaded is not a very good benchmark IMO, a real project will have lots of them.

I've worked on a large project with many namespaces and dependencies and it took about 20 seconds.

Re: Ask HN: Is Clojure Dead?

#134
post #103

Earlier quoted context omitted.

What domains are you using Clojure in?

So far: complex data visualization, transportation logistics, voting-related nonprofit, medical research, and augmented analytics. I like to explore new domains :)

Could you expand a bit on data visualization and medical research? Did you develop libraries in these fields? Thanks!

Re: Ask HN: Is Clojure Dead?

#135
post #113

Earlier quoted context omitted.

It's not a workaround. It's how Clojure is designed, around its REPL, intended for interactive development at its core. Start a REPL, connect your editor, develop. You can start your apps in the REPL (from RCFs in your code -- Rich Comment Forms) and never type into the REPL. You can grow the application while it is running, you can run tests via the REPL from your editor. That interactive approach -- working on your…

I'm very familiar with the live editing aspect of Clojure, and I like it a lot actually. What I am saying is that Clojure's long startup time is still annoying if you want to restart, for example if you trashed your repl session or want to start with a clean slate. If Clojure would start fast enough it could also be used for CLI scripts and we would not need Babashka at all. All in all, I think Clojure is a great lan…

Sure it's a disadvantage, but the way you say it makes it sound like it results in a terribly slow development experience where you're constantly waiting for it to start.

The truth is, the development experience actually gives you much faster feedback with almost no waiting time as compared to the majority of other languages.

That means the impact of the slow startup isn't really felt.

I think where slow startup is a bigger issue is actually for certain production use cases, like CLIs, or serverless settings. There it would be awesome if Clojure JVM also started in sub-millisecond, and we didn't have to change to Clojure interpreted like babashka, or Clojure GraalVM native compilation.

Re: Ask HN: Is Clojure Dead?

#136
post #133

Earlier quoted context omitted.

Wait, how slow is it starting for you? On my 2012 Mac Mini, a clean clj 1.11 REPL (with no namespaces loaded) starts in under 5 seconds (using JDK 18).

No namespaces loaded is not a very good benchmark IMO, a real project will have lots of them. I've worked on a large project with many namespaces and dependencies and it took about 20 seconds.

That seems pretty slow, I've never had it take more than 5 seconds, even on large enterprise backend services.

Maybe your service was also initializing a lot of state/components on startup?

Re: Ask HN: Is Clojure Dead?

#137
post #67

Earlier quoted context omitted.

Yeah, Clojure is not great for CLIs, but pretty much every other use case it excels at. For CLIs, there is always Babashka ( https://babashka.org/ ) which works good enough. For local development, you usually just compile+eval one function at a time as you change them, and those happens under 1ms, not enough to even notice (unless you develop with a remote REPL, but then network is to blame) For server usage, you usu…

No, you are missing the point. Slow startup and long compiles is a hindrance to all kinds of development. You can ask developers to adapt and use a long-running repl, but they won't. Complain all you want about drama and how stupid people are, they still won't choose Clojure.

> You can ask developers to adapt and use a long-running repl, but they won't

I mean, that's a you problem. My team is well adapted.

Does your team also code in notepad exclusively and chooses to not use an editor with IDE features? Cause I feel that's your argument, that people won't bother using any tooling when developing in a language out of laziness to learn to use tooling?

Even if the REPL started in sub-milliseconds, I'd still be connected to a long-session most of the time. Why restart it constantly? There's no point, you lose your state, you lose the context you were in, it take me out of my productivity zone.

Re: Ask HN: Is Clojure Dead?

#138
post #79

Earlier quoted context omitted.

> Slow startup and long compiles is a hindrance to all kinds of development What kind of development do you do where you have to recompile the entire program and restart the process on every change? No Clojure developer develops like that, just like no Smalltalk developer would reload the entire environment for every change, or no Rust developer would recompile the entire dependency tree for every change. In Clojure…

REPL driven development is great, but there are still tons of situations where you want a full recompile and restart. Slow compile and start time really slow down development. Recently I was porting a small application from Clojure to Rust, and 'cargo watch -x run' was faster than 'clojure.tools.namespace.repl/refresh' and is more reliable.

> Recently I was porting a small application from Clojure to Rust, and 'cargo watch -x run' was faster than 'clojure.tools.namespace.repl/refresh' and is more reliable

I think this tells me we differ greatly in our development approach. Because it seems you still practice a kind of traditional TDD.

I'm not saying one is better, but I think this is either a personal preference of style, or maybe you haven't tried the Repl driven approach?

For example, I almost never use REPL/refresh.

Any amount of, delete state, reinitialize the whole app from scratch, be it by restarting the app like cargo does, or some tear-down/re-init like refresh does, is a very different approach to how I use the REPL, where I make many small changes that I hot-reload as I go, never really needing a full refresh.

That allows me to maintain state and context as I code.

Also, small applications are nice, but most real app will grow to be big applications, not sure how `cargo watch -X run` will keep up in that setting, it doesn't just become compile/start times at some point, it's also how long does it take to instantiate your SQL driver and establish a DB connection, start your web server, etc. REPL driven development allows all this to be initialized in the morning when you start your day, and just kept open till you clock out. So all development throughout the day you get instant hot-reloads of the functions you're changing, while maintaining all that state alive as you go.

Re: Ask HN: Is Clojure Dead?

#139
post #31

Earlier quoted context omitted.

I mean compared to a few years ago. I tried setting up a new project after 1 or 2 years away from the ecosystem, and struggled a lot : all existing templates to set up new projects (esp. with CLJ/CLJS combined) had bitrotten and were not usable out of the box ; emacs integration no longer working out of the box, etc. I think it's a "death by a 1000 cuts"/"broken windows" that is may be happening when the ecosystem la…

Similar experience here. My first Clojure(script) projects used leiningen, now everything is deps.edn and the clojure CLI. Cool, changes happen. But editor integration, REPL tooling, even which compiler to use, etc are not consistent either. The tooling is changing everywhere and bit rot has claimed almost all of my past projects. The code is still 100% compatible but the build system is just broken. I've given up tr…

Ya, I think everyone is aware that the beginner ramp-up experience isn't great, but no one knows what to do about it.

There's a bit of a chicken and egg, because once you know, you know, and the problem disappears, but that doesn't help the next beginner have an easier time.

Re: Ask HN: Is Clojure Dead?

#140
post #61

Earlier quoted context omitted.

You think Java of C# (originally) is any better?

Is Java supposed to be the best or the worst here? comparing oneself to the worst is not a good look… I’d rather Clojure have a nice open tracker system you can submit issues/PRs to instantly (without preapproval) like most Github/Gitea-hosted OSS projects do.

It's an open source project, the benefit of being a bit closed down is that you can then focus on coding instead of scrolling through issues/PR all day. Who wants to do that?
Post reply on HN