3 ms·
I like Clojure but ended moving away from it to Racket instead. The error messages and debugging story in Clojure just plain suck, and have for a long time now.
by hacker_9 10y ago
I like Clojure but ended moving away from it to Racket instead. The error messages and debugging story in Clojure just plain suck, and have for a long time now.
Error output is just java stacktraces, which for a newcomer make zero sense. I got stuck for two days on something before realising the problem was because of a lazy list elsewhere in the program. The CIDER debugger is pretty good, but I can't help feel that people who sing it's praises haven't been exposed to graphical debuggers like in Visual Studio, which offer a far superior experience. Additionally there is no break on exception functionality, and you have to actually commit a debuggable version of a method before you can step through it. Combined with the nonsensical erro output, you can be looking for hours for the actual location an error occurs. Which is bizzare because functional languages usually make error finding a breeze because mutable state is so locked down.
I'll mention Cursive too, which is an intelliJ plugin, that does actually offer a really good editing experience, and more importantly a modern graphical debugger that makes sense. But it's only a 30 day trial before you need to pay, and because Clojures error messages are still useless I just can't see a reason to pay for something I get for free with any other language. It's a shame because otherwise the Clojure library comes across as really well designed.
Since moving to Racket, I've been a lot more productive because of the out of the box editor it ships with, which along with its built-in package manager, really make it feel like you can hit the road running.
- ClashTheBunny 10y agoCursive is free for non-commercial use: https://cursive-ide.com/buy.html https://cursive-ide.com/buy.html If you are working on personal projects, you are good to go.
- jstewartmobile 10y agoThat's the fatal flaw--being a layer over the JVM. It's a shame since the rest of it, as well as the community, is top-notch.
- markc 10y agoYes, stack traces suck, but being on the JVM is also a gigantic win for its runtime ecosystem and vast collection of solid libraries that you can access almost seamlessly. I.e. it's a flaw, but hardly a fatal one for large numbers of enthusiastic Clojurists.
- cle 10y agoIt's not just being on the JVM that causes the annoying stack traces. It's certainly possible for Clojure to inspect errors and provide better ones. But then it needs to know a lot more about its hosting VM. The crappy stack trace situation was a design decision to keep Clojure loosely coupled to its VM, allowing it to be more easily ported to JS (ClojureScript), .NET (Clojure-CLR), etc.
- jstewartmobile 10y agoI'm not just complaining about the stack traces. I'm straight-up hating on the JVM. Rich Hickey is a genius for making it as tolerable as he did.
- joncampbelldev 10y agoYMMV, my opinion etc etc: For me its a huge advantage, massive ecosystem of existing libraries to fill any gaps in the clojure ecosystem and an extremely fast garbage collector + JIT. Stack traces are annoying though, but fixing those is waayyyy easier than replicating the JVMs advantages. Fast, bulletproof GC is beyond essential when using persistent data structures.