Fork me on GitHub
#clojure-dev
<
2018-11-13
>
danielcompton20:11:52

@alexmiller thanks for fixing CLJ-2427 🙂

danielcompton20:11:19

I have a query/question about some of the new error messages

danielcompton20:11:43

If I use a namespace without requiring it, or use an alias without adding it to a require, I get an error which is a syntax error

danielcompton20:11:24

#error{:cause "",
       :via [{:type clojure.lang.Compiler$CompilerException,
              :message "Syntax error compiling at (<myfile>.clj:127:1).",
              :data #:clojure.error{:phase :compile-syntax-check,
                                    :line 127,
                                    :column 1,
                                    :source "<myfile>.clj"},
              :at [clojure.lang.Compiler load "Compiler.java" 7649]}
             {:type java.lang.ClassNotFoundException,
              :message "",
              :at [java.net.URLClassLoader findClass "URLClassLoader.java" 381]}],
       :trace [[java.net.URLClassLoader findClass "URLClassLoader.java" 381]
               [clojure.lang.DynamicClassLoader findClass "DynamicClassLoader.java" 69]
...

danielcompton20:11:58

I was surprised that it was a syntax error. I think of syntax errors as problems where the code is not well-formed and is syntactically incorrect

danielcompton20:11:23

Using a namespace without requiring it seems like an error, but seems like maybe a different class of error?

alexmiller20:11:25

yeah, so the Compiler is not very disciplined right now about which exception types it uses

alexmiller20:11:36

we have two phases defined - :compile-syntax-check and :compilation

danielcompton20:11:45

Yeah, was thinking it was more about the phases

alexmiller20:11:48

at the moment, everything is being reported as :compile-syntax-check

alexmiller20:11:27

but if you look carefully, the Compiler code throws a variety of exception types with no correlation to these two kinds of errors

alexmiller20:11:53

this particular case is one where getting a :compilation phase error would make more sense

alexmiller20:11:28

and in that case, you should get a different message (I can’t remember but I think the code for that is there already)

alexmiller20:11:48

so I have a todo to go through and make the compiler more disciplined about this, but I’m not going to do it for 1.10

danielcompton20:11:02

k, no JIRA ticket needed then?

danielcompton20:11:12

or is it a helpful example?

alexmiller20:11:15

oh, I should probably make a generic one

alexmiller20:11:40

it’s pretty easy to look at the code with this eye and separate

alexmiller21:11:35

so I’d rather have one generic ticket than a zillion specific ones

danielcompton21:11:02

Just re-read my messages, https://clojurians.slack.com/archives/C06E3HYPR/p1542142399247200 was meant to be a separate statement, not specifically asking for you to look at it

danielcompton21:11:10

Though I can see how that wasn't very clear

danielcompton21:11:02

I normally try not to @ mention anyone in specific for a question like that

alexmiller21:11:12

I’ve got enough keyword triggers set up that I got a notification on it anyways :)

alexmiller21:11:29

and I try to always read this room regardless