5 ms·
It occurred to me this morning that I should learn Clojure instead of Rust for non-lowlevel code because Clojure solves the same problems Rust solves in a much
by labrador 11mo ago
It occurred to me this morning that I should learn Clojure instead of Rust for non-lowlevel code because Clojure solves the same problems Rust solves in a much simpler way. I'm a fan of Clojure author Rich Hickey's "Simple Made Easy" talk but otherwise don't know either language in detail and need to do more research.
- armitron 11mo agoClojure is a niche language that (for realistic purposes) is still tied to a single platform, the JVM, which (Clojure, not the JVM) looks more dead with every passing year. It never became popular and it's been steadily losing users. It's also not as general purpose as Common Lisp (ie. not suited for system or lowlevel programming). If you're going to learn a niche Lisp, you might as well learn Common Lisp or Scheme which have well-specified standards, have stood the test of time and will still be around for decades to come.
- lenkite 11mo ago> the JVM, which looks more dead with every passing year. Lol, only dying/dead in the febrile imagination of some HN commenters. The JVM has had some of the most explosive feature activity in the last several years. Java had several million greenfield projects in 2024-25 - among the top 6 greenfield programming languages according to the Github Octoverse.
- kleiba 11mo agoBut also: https://survey.stackoverflow.co/2024/work#3-salary-and-experience-by-language https://survey.stackoverflow.co/2024/work#3-salary-and-exper...
- kragen 11mo agoProlog and Dart programmers earn the least, but Erlang and Clojure programmers earn the most? Something is fishy here...
- kleiba 11mo agoI would take this statistics, like every other one, with a grain of salt, but still wanted to put it out there as a possible discussion point.
- cmrdporcupine 11mo agoLikely just not a statistically significant enough sample of any of those to justify them even putting them on the chart. Except maybe Dart, and that gets the "curse" of being front-end tech which for some inexplicable reason is underpaid.
- kragen 11mo agoYeah, that seems likely. Although it's lower than PHP!
- kamaal 11mo ago>>Clojure programmers earn the most? All the best finding a Clojure job though. Im guessing they pay all that much, while simultaneously cursing themselves for not using Python instead, and swearing to never use Clojure again. I know that as I have seen people do and say similar things about Perl and Erlang in the last decade.
- sjamaan 11mo agoNope. I mostly happily used Python in my previous job for many years, now I'm doing Clojure. There are benefits and drawbacks to each, but I don't know if I'd want to go back to Python. I'm a Lisper (Schemer, really) at heart so maybe I'm biased. Having said that, I don't think I'd pick Clojure for unpaid (hobby) projects. The JVM is such a hog and I don't like anything related to the Java culture...
- kragen 11mo agoI suspect kamaal meant that the people who hired you are cursing themselves for making such an expensive decision.
- lycopodiopsida 11mo agoI prefer CL, but… clojure at least has some commercial usage and is by far the most successful of current lisps, if we do not count elisp.
- vindarel 11mo agoJust to counter-balance the inferred conclusion that Common Lisp would not have any commercial usage (sorry, words are important, FUD is too close from hasty wording or hasty conclusions): https://github.com/azzamsa/awesome-lisp-companies/ https://github.com/azzamsa/awesome-lisp-companies/ (example companies using CL today, and yes some pick it for new projects, and yes some hire) (and I don't want to argue if the list is impressive or not: it's some commercial usage :D best,)
- mpenet 11mo agoClojure will be around as long as the jvm. It’s mostly done at the core level, most updates are to leverage new host features nowadays. The rest is happily provided at the library level by the community (which is still very prolific). And it’s not tied to the jvm per say, look at clojurescript (and derivatives) or the upcoming jank. It’s far from dead. As much as I like CL, the ecosystem is a bit of a desert compared to the jvm.
- labrador 11mo agoWow. I clicked on your user name for some reason. You've been here 19 years and only have 34 karma and made only 16 comments! Anyway, I came here to say Clojure also targets JavaScript and could target more like ClojureCLR https://clojure.org/about/clojureclr https://clojure.org/about/clojureclr Here, have another karma point!
- mpenet 11mo agoThanks! Long time lurker indeed. I also forgot the very solid ClojureDart.
- bitwize 11mo agoThe JVM has suffered a fate worse than death: it's become so wildly successful that it's boring. So much enterprise shit runs on Java that it has sort of faded into the background noise of civilization and, like the System/360 (now Z/OS) before it, doesn't grab headlines anymore.
- gleenn 11mo agoWhich makes Clojure extra tempting because there is a bit of a infectious way to get Clojure i to corporations when you are always just handing the ops guys a "Java" we app bundled as a jar but secretly inside it's all Clojure compiled classfiles that work perfectly run on many JVM-based web servers with no additional effort. I think Rich even alludes to this fact in one of his talks where it would be disallowed to run Ruby/Python/Rust whatever but it's Java then it's a know entity.
- bitwize 11mo agoYeeeeah, except we're living in the DevOps era, which means things like "thinking about how this will be built and deployed" is now the devs', therefore the whole organization's, responsibility, and so you have to think about whether your CI/CD pipeline can accommodate, or be made to accommodate, the Clojure compiler, leiningen, et weary cetera. There's another, orthogonal, aspect: I half-jokingly suggested Clojure as a substitute for one of the DSLs we use at work, and my idea was shot down by a teammate based on the reasoning that Clojure is hard and most of the Java devs (not my team, of course) in the shop are not up to learning it or coding in it. So that's another thing to consider: when you leave the company, who else will be up to maintaining what you produce? Both of these considerations weigh strongly against attempts to "sneak Clojure in through the back door".
- kloud 11mo agoAlthough niche, things are pretty lively in the community. Among other things this year great progress was made on Jank, the native LLVM-based implementation with seamless low-level C++ interop. As part of that work a test suite is being created [0] and now includes runners for all of the major implementations to compare compatibility, next best thing besides a formal specification. [0] https://github.com/jank-lang/clojure-test-suite https://github.com/jank-lang/clojure-test-suite
- cmrdporcupine 11mo agoI frankly miss the JVM. I work almost exclusively in Rust these days and haven't worked in Java or Scala since 15 years ago, and I do prefer working closer to the metal.... But... The JVM is an amazing mature runtime with a boatload of tooling. JMX, which has been there since almost the beginning, is the kind of thing missing from almost everything other managed runtime I've worked with. The amount of R&D that has gone into making it execute with good performance, and its overall stability... Yeah, it's got the curse of being boring. I do think it is perhaps unfortunate that Clojure is tied so heavily to the JVM, because I actually don't think it gains much from that ecosystem... but it's a product of the time it was first written. Actually hell. I'm between jobs, I like Lisp, and I miss the JVM. I've never worked in Clojure, but does anybody want to hire me to work in it? :-)
- asa400 11mo ago> I do think it is perhaps unfortunate that Clojure is tied so heavily to the JVM, because I actually don't think it gains much from that ecosystem... but it's a product of the time it was first written. When I was doing more Clojure, I loved that it was on the JVM because it meant I got to use every Java library under the sun. There are tons of battle tested Java libraries that didn't have to be rewritten in Clojure, and getting to use them for approximately zero financial and runtime cost was a HUGE benefit of Clojure compared to other niche FP languages.
- labrador 11mo agoI don't care if it's niche if it solves my problems and gets the job done faster.
- chamomeal 11mo agoJVM is very much not dead even slightly. They just released virtual threads, which are ridiculously awesome. Also it's not tied to a single platform, clojurescript lets you write clojure in browsers and on node.js, and babashka lets you use clojure in a scripting environment via a single executable
- galaxyLogic 11mo agoI haven't tried clojurescript but I'm fearful of languages that run on top of other languages or platformks, because of complications that produces for debugging. How do you debug ClojureScript? Can you modify the source-code while in the debugger? That is a huge time-saver, you debug and see a typo and fix it right away. My preference are influenced by my background in Smalltalk's "live" environemnt: you see the variables, the stack, and can change anything without having to stop the debugging session and then have to go back to the "editor" and then locate the place you (now know) you want to modify, and then start again.
- chamomeal 11mo agoHm I definitely haven’t tried a debugger! I’m not sure if that’s a PITA to set up. I had a terrible time trying to get a debugger working with typescript on top of node. Since clojure is so REPL heavy I haven’t felt like I’m missing a debugger too much. But the smalltalk live environment sounds ridiculously cool. I do end up using REPLs to remote programs (even prod lol) pretty often, which is pretty crazy for me coming from a node background
- AnimalMuppet 11mo agoYou're saying that Clojure is looking more dead, so you suggest... Common Lisp? That looks considerably more dead than Clojure.
- tjr 11mo agoI'm not sure that Common Lisp looks less dead, but rather, more eternal.
- lucyjojo 11mo agoClojure is not going anywhere anytime soon. It sees plenty use as Clojure/Clojurescript and Babashka. (and other niche variants). Jank is shaping up to be real nice too.
- deleted 11mo ago[deleted]
- lucasoshiro 11mo ago> Clojure solves the same problems Rust solves in a much simpler way I'm curious about that, can you elaborate? I'm a beginner in Clojure and I only know a few concepts about Rust, but it seems to me that they solve (at least, currently) very different problems... I only saw Rust being used in places where C or C++ would be used in the past (Linux kernel, CLI apps, desktop apps), while I only saw Clojure being used as a modern and functional Java and JS replacement. Not to mention how different they are as languages (static vs dynamic typing, native vs jvm, borrow checker vs garbage collection)
- labrador 11mo agoOne thing that jumped out at me is you don't need Rust's borrow checker to prevent thread race conditions because data in Clojure is immutable. That's a huge simplification over Rust. What I hear mostly about Rust is complaints about the borrow checker. I wrote a simple Rust utility and found it frustrating. But again, don't take my word for it because I don't know either language.
- deleted 11mo ago[deleted]
- bmitc 11mo agoI would argue that F# would be the choice of language in place of Rust if you don't want to deal with Rust's type system. F# is immutable by default with good concurrency and a static type system.
- labrador 11mo agoThat's a great suggestion I had forgotten about, which is strange since I'm a C# programmer. Part of me wants to really learn a Lisp to see what it is special about it that I keep hearing about. I tried Racket and Steel Bank Common Lisp but they didn't seem appropriate for the commercial programming I'm used to. Clojure is being used commercially.
- 11mo ago
- kragen 11mo agoHow does Clojure do on McCarthy's desiderata from this paper, as you see it?
- beders 11mo agoThe Clojure (or any Lisp) journey is very different, not because of the language per se, but because of the developer experience. In Clojure, there's no appreciable compilation time. During my work week I barely, if ever, restart the application I'm working on: I'm working inside of it via a REPL connection. It's an entirely different ball game and if you just compare language features you are missing out on an incredible interactive coding experience.
- labrador 11mo agoDoes it scroll? Because I like to scroll around when thinking about my program. I always imagine Lips REPL ppl saying they keep the entire program in their head but that can't be right. That's doing things the hard way.
- weikju 11mo agoYou have files and editors for your files, eg emacs or vim or vscode. Your editor is also directly connected to your running application and can compile individual functions or pieces of code to update the application without a full edit/compile/run/test loop. It happens way faster and more interactively while you code. You can directly inspect the running program and its data within that same framework and with the exact same tools and functions you use to code. To answer another way, you don’t code your application in a REPL, like by line , but with all the tools you’d expect (editor or ide, git, etc) PLUS that live connection to your software.
- skydhash 11mo agoThe nice thing about REPLs is that you can try random snippets code. And as the sibling comments put it, you rarely switch to the prompt interface. Instead you `eval` a bit of code and it got sent to the running state of your program as if you've typed it as the prompt. It's more like brainstorming a program using a mood board. You kinda have to keep track of the state, but the latter can be easily inspected so there's no need to keep it your head.
- bandrami 11mo ago
- funkaster 11mo agoI would recommend taking a look at some of the schemes. In particular I've been having tons of fun with CHICKEN: https://call-cc.org/ https://call-cc.org/ - the fact that it compiles to C and can generate binaries is a great plus.
- calgoo 11mo agoI have been enjoying Chez scheme these last few weeks, and having an LLM has helped me when i have missing libraries. The ability to just wrap a C library and statically link everything into a single binary has been really nice too!
- chamomeal 11mo agoAs an anecdote, about a year ago I realized I was not having that much fun learning rust. Randomly landed on clojure instead and have absolutely loved it. Particularly as a noob, babashka is SUCH a good way to learn the language. I’ve written myself all sorts of fun utilities with babashka and have learned so much clojure along the way. Even got my coworkers to use my bb scripts!