4 ms·
It's sad to hear this is still an issue. For those who don't know, Clojure's error messages... aren't. They take the form of a stack trace from the compiler's
by phyzome 3y ago
It's sad to hear this is still an issue.
For those who don't know, Clojure's error messages... aren't. They take the form of a stack trace from the compiler's internals, and that whole stack trace just gets barfed out onto the terminal. There's an exception message but it sometimes just isn't that helpful.
I know there was an effort a while back to improve the situation, but last I saw (2019) I believe things were only marginally improved. It's a shame because other than that it's really quite a fantastic language.
- smw 3y agoIsn't that true in most common languages? Python and Ruby and Java and Go (panics) will all spit out the stacktrace?
- phyzome 3y agoThis is about compile-time errors, not runtime errors.
- scotty79 3y agoClojure spits out Java stack trace if you make syntax error. It's equivalent of Python barfing segfault when you put tab in the wrong place.
- fulafel 3y agoThis doesn't happen with the normal REPL (or invoking with clj -X) after a couple of first examples that came to mind: user=> (defn foo [[a b] (+ a b)) Syntax error reading source at (REPL:14:26). Unmatched delimiter: ) user=> (defn foo [a b] a/b) Syntax error compiling at (REPL:1:1). No such namespace: a user=> It will give you a stack trace of the compiler when asked following a syntax error though, with a disclaimer not to confuse it with your own code: user=> (pst) Note: The following stack trace applies to the reader or compiler, your code was not executed. CompilerException Syntax error compiling at (1:1). #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "NO_SOURCE_PATH"} clojure.lang.Compiler.analyze (Compiler.java:6808) clojure.lang.Compiler.analyze (Compiler.java:6745) [...] Possibly you were using tooling that always tried to present the stack trace without discerning between kinds of evaluation errors?
- phyzome 3y agoThat does look considerably better than what I used to see.
- aphyr 3y agoTbh I think they've actually gotten worse in recent years. This thing where the compiler spits out a stacktrace to /tmp and makes you go and cat it? Absolutely awful. And the move to spec, ugh, UGH. I have wasted so much of my life looking at spec errors for (e.g.) namespace declarations and being completely unable to tell what was wrong. I don't know how to fix this, unfortunately.
- phyzome 3y agoOh god, right. I largely switched to Kotlin in 2019 so I didn't get a lot of exposure to that, but your comment is bringing it all back...