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

Problem with reader literals and tools.namespace #11

Open
mmower opened this issue May 21, 2014 · 3 comments
Open

Problem with reader literals and tools.namespace #11

mmower opened this issue May 21, 2014 · 3 comments

Comments

@mmower
Copy link

mmower commented May 21, 2014

Hi Jake.

So a problem has popped up that appears to be related to the use of tools.namespace for reloading (I'm reporting some detective work by llasram in #clojure here):

Ok, so usually namespaces are created on-demand and never removed
When clojure.core is first loaded and initialized data-readers, it creates
namespaces and vars for all the referenced reader functions, which will
be at that point unbound
Normally, when you then load a namespace, if the namespace object
already exists, it just creates/updates the bindings for vars in the namespace
But the tools.namespace reload code is destroying the namespace itself,
and creating a new one to then load code into
The data-readers map is left holding a var in a namespace object which
no-one else can see, and never gets new code loaded into it

The net result is that if you try and use a reader literal in your test code you get an exception, see: https://www.refheap.com/85727 which you don't get in normal use or from the REPL.

Any thoughts?

m/

@jakemcc
Copy link
Collaborator

jakemcc commented May 21, 2014

Will have to look into it. Seems like either might need to do something different with tools.namespace or try to figure out if tools.namespace can be patched.

@jakemcc
Copy link
Collaborator

jakemcc commented May 21, 2014

This is hacky and not actually a solution but you may be able to stop a specific namespace from being reloaded.

https://github.com/clojure/tools.namespace#managing-reloads

I haven't tried this but it seems like you may be able to do what it suggests to force certain namespaces to not be reloaded.

@mmower
Copy link
Author

mmower commented May 22, 2014

Hi Jake. I'm not sure how I'd apply this workaround as the namespace I'd need to stop reloading contains the namespace I'm testing which is, I assume, what is getting reloaded for each test run?

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

2 participants