Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how import-vars interacts with direct-linking and namespace reloading #50

Open
halgari opened this issue Jan 6, 2017 · 2 comments

Comments

@halgari
Copy link

halgari commented Jan 6, 2017

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 on import-vars if we're going to continue to see this library crop up in CLJ libraries.

@ztellman
Copy link
Collaborator

ztellman commented Jan 7, 2017

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

@vemv
Copy link

vemv commented Feb 9, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants