2 ms·
It's been a while since I tried to get into Clojure/Cljs but when I did I remember errors like the one in this article being cryptic: https://8thlight.com/blog
by chickenfries 9y ago
It's been a while since I tried to get into Clojure/Cljs but when I did I remember errors like the one in this article being cryptic:
https://8thlight.com/blog/connor-mendenhall/2014/09/12/clojure-stacktraces.html https://8thlight.com/blog/connor-mendenhall/2014/09/12/cloju...
> Caused by: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
What's an ISeq? I can guess that' it's part of clojure's implementation from java.lang.IllegalArgumentException, but that's what I'm talking about when saying that clojure isn't a great first language because of how you have to both understand a little bit about clojure and a little bit about java, when it comes to errors and namespaces.
- hellofunk 9y agoClojure doesn't have the most obvious errors in the world to a newcomer, that is true. A good book on Clojure will quickly remove any confusion about what ISeq means, but a bit of practice makes those low-level understandings not required. The article you mentioned accurately says this: > Although Clojure's errors are notoriously unfriendly, they're easy to read with a bit of practice Once you realize that much of what happens in Clojure is based on data sequences, it becomes clear that an individual keyword is not a sequence, so it was probably used incorrectly somewhere. That's an interesting article comparing the errors from Ruby with Clojure. They are about the same, the only difference is that Clojure gives you a lot more information in the form of an ugly stack trace. Fortunately, many editors in Clojure automatically hide the stack trace and only show the error. After you've seen errors a few times in your first week using the language, fixing them becomes second nature. This is one of the tradeoffs using a dynamically typed language: there will be more debugging of runtime problems. In return for that, you spend less time on other things. The fact that there are very successful languages in both the dynamic and static typed camps shows that benefits can be found everywhere.
- agumonkey 9y agoI wonder what would happen if vanilla clojure came with a commonlisp style debugger on error. CL errors can be intimidating but the interactive debugger makes things almost fun.
- hellofunk 9y agoFigwheel has time-travel debugging, which is nifty. To be honest, my debugging is quite basic and quick, I've been doing it long enough that when I see an error it's clear what the fix is almost immediately. I suspect this is what happens in most languages regardless of their error handling mechanisms.