Clojure tradeoffs and how to mitigate them?

Well, I guess not for everybody and that’s just back at me not understanding why that wouldn’t be the case :stuck_out_tongue_closed_eyes: for everyone. Cause doing C++ and Java is intolerable now to me because of this. Sometimes I just want to run some code, but there’s so many layers to being able too it’s painful. Anyways, I guess it is to each their own, I think each programmer should find the toolset and arsenal that makes them most effective, in the end that’s what it is about, and different people think differently and have different ways to approach and tackle code. That’s why I’m generally pro-polyglot. On my team we let people pick if they want to use Java or Scala or Clojure or Kotlin for their tasks, mixed projects with Scala are a bit harder, but the other three you can have different parts of the same code base be on all three. In practice most people choose Java or Clojure. We haven’t had major issues with the use of mixed language projects yet, though it is interesting sometimes realizing the extra ceremonies to marshal data in Java :wink:

I didn’t mean Emacs as an editor, I meant if you’ve ever written Emacs Lisp. I’ve never used Smalltalk images or the Lisp Machines of yore that I hear tales of. But the working within an image that you export always fascinated me, and I feel Emacs lisp is the closest experience I can have to relate to those past experiences. From some videos of symbolics lisp machines it seems a lot like what you get with Emacs Lisp, but if the whole OS was Emacs itself feels dreamy to me.

But, I guess we’ve gone very off topic at this point. Apology to the OP about that :sweat_smile:

Not too far off. We’ve mainly been talking about the REPL. :slight_smile: To get the train back on the tracks, I would disagree about the REPL being a work around but I understand how they might feel it’s not productive.

As far as how to prevent that from causing people to abandon the language, I think it comes down to the fact that everything you read about Clojure equates Clojure = REPL. So, if somebody doesn’t have the mindset that is conducive to using the REPL, I could see that causing them to turn away from the language. The only way to fix that would be to turn down that rhetoric.

But, that does raise an honest question for everybody. If the REPL didn’t exist, would you still use Clojure? Is it still a viable, useful language without that tool? I’d still be interested in it, obviously. I rarely use the REPL and here I am. If the answer to that is no, that the primary reason people use Clojure is for the REPL, that would go a long way towards explaining way people are turning away from it and you just have to accept those losses as “nothing works for everybody.”

2 Likes

It’s a really well-designed language. I initially learned it without knowing in advance about the REPL and it was actually quite a while before I developed the “flow” of using the REPL as my primary tool. I think that means, yes, I’d probably still use Clojure if it were still compile-on-demand and I could use it like a dynamic scripting language but it didn’t have a REPL.

The REPL is the tool I didn’t know I really, really wanted though and I would have a very hard time now switching to any language that didn’t have a REPL like Clojure’s (and I qualify that because Clojure’s REPL is not like the “REPL” that Python/Ruby/etc have – and certainly nothing like Java’s fairly pathetic interactive shell).

2 Likes

You ask a great question. Honestly, I’m not sure I would. That said, I don’t know if the “REPL” is really the right way of seeing things for me. I think it is the dynamism of the language, the REPL just being one tool that exposes that dynamism to you.

What I mean by dynamism is that you can modify the program as it is running. To be fully dynamic as such, it should be possible to modify all aspects of the program as it is running.

That’s one of the aspects that I really enjoy from Lisps languages. In theory, as long as the language is dynamic as such, you can easily add a REPL to it. So I’d say if Clojure wasn’t dynamic I probably would not use it.

That includes the REPL, but also things like REBL, all Cider middlewares, eval, reified types, runtime code loading, etc.

Hard to say though, cause everything about the language is well thought out. The core functions are super useful and flexible, the data literals are great, macros always a plus, good concurrency abstractions, immutability by default, I still prefer the Lisp syntax over others, etc.

But without the dynamism, I might be tempted to go back to a statically typed language of some sort or some other more dynamic language. At least I’d feel like I’d be shopping around a bit more, where as now I’m quite contempt with Clojure.

I’m a big fan of Fantom for the JVM and JS, so that might become my main replacement for Clojure. I would maybe switch to one of the other Lisps (but I guess I’m assuming here a bit that those wouldn’t exist either). I’d probably do more Rust, and I’d get a chance to try Zig. And if everything with Red goes well, maybe I’d become an adept user of it.

But thankfully I don’t have too :stuck_out_tongue:

My REPLs usually run for weeks at a time. I have none of the state problems you’ve mentioned here. My work is almost never web apps. That said, I’ve never seen a browser-connected Clojurescript REPL with that sort of reliability or stability, which I think is one of the reasons most people develop those applications with a “hot reload” workflow instead.

When @seancorfield mentioned not really being comfortable with the REPL, that doesn’t mean “hasn’t used the REPL enough” so much as “never really embraced the REPL nature.” This is a problem I’ve seen many times when people have tried to adopt clojure: it often requires mentorship to bring someone up to speed on several aspects, and if they don’t get it they’ll often end up trapped at a lower productivity level and give up.

6 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.