Open halgari opened 7 years ago
Hi Tim,
I'm sorry to hear that you've run into problems. In theory, there should be no mismatch with namespace reloading; if the referenced var is changed, the value for the imported var should also change [1]. As for direct-linking, it's not clear to me why this would be a problem either, since (as far as I understand) it removes any dereferencing, in which case both vars would simply represent the same value.
Can you give me some examples of the issues you've seen in the past?
[1] https://github.com/ztellman/potemkin/blob/master/src/potemkin/namespaces.clj#L3
I'm finding the specific problem that
(binding [*compile-files* true]
(require 'potemkin))
(or same for any other potemkin ns) will generate no .class file at all.
The implication of this, is that if you clojure.core/compile
e.g. clj-http
which depends on Potemkin, you will get .class files for clj-http, which internally have references to Potemkin.
So requiring an aot-compiled clj-http will fail with:
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:382).
potemkin.types.PotemkinType
It seems plausible that it's failing because AOT-compiled clj-http assumes that potekmin .class files also exist.
Does that make sense?
It seems like there would be issue with direct-linking, AOT, namespace reloading etc, and
import-vars
can we get some documentation on these interactions? I've run in to quite a few Potemkin related bugs in the past in these areas and I'd love to see some documentation onimport-vars
if we're going to continue to see this library crop up in CLJ libraries.