Closed Bronsa closed 10 years ago
From IRC chat with Bronsa, solving this may be possible by always having Eastwood lint namespaces in dependency order. Using tools.namespace to determine that order might be a solution, but needs investigation.
Just a few notes for how this change can be made, from some experimentation I have done:
The following code in a REPL session will show a list of namespaces in an order they can be loaded in that will respect all dependencies declared in ns forms, expected to be the first non-comment form in each file:
(require '[clojure.tools.namespace.track :as t] '[clojure.tools.namespace.dir :as d]) (def t1 (d/scan-all (t/tracker))) (pprint (:clojure.tools.namespace.track/load t1))
d/scan-all will scan all files in the Java classpath, which in a Leiningen REPL started with 'lein repl' includes the source-paths and test-paths.
:+1:
There are troubles with protocols/multimethods due to the fact that
analyze
creates a stub deftype at analysis time.https://github.com/jonase/eastwood/commit/476fe911fb2b7002dffccd12b778d3d73cadfd8a and https://github.com/jonase/eastwood/commit/d7c49f55d35cad60c8c0aae632632d55ba65498d addressed this issued for vars but there's no way to control this for deftypes.
The only solution to make this work seems to be to reload the namespaces that depend on the namespace just analyzed in order to "fix" the multimethods/protocols.