-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement reload-all by regex #14
base: main
Are you sure you want to change the base?
Conversation
Thanks, I’ll take a look soon |
Hi! I took a look, and have couple of suggestions:
I know it sounds like much, that’s why I was resistant to implementing this myself :) But should be doable. I suggest we start with some measurements though. To decide if this should be “enabled for everyone, always” or as an option. That will affect API design |
Sure. I didn't went the integrated route in part because it was more complex, and in part because it would mess with the currenty functionality which I was trying to avoid (so you didn't need to worry about it). I was trying to design it as a separate utility that clj-reload provided, but I agree that having an integrated api is much nicer. Also agree that for going the integrated path we need some numbers for the perf.
I agree. We can try directly from resources, but then we need to somehow go from resources to namespaces, and then filtering out what isn't loaded. I don't think it is nice to tell it to reload #"ring*", and suddenly you have loaded a bunch of ring something namespaces that weren't loaded before. |
But that’s already how it works. It scans everything but only loads what is already loaded |
First try to implement reload-all by regex as described in #10
Per requirements on the issue this PR :
The main thing here is
clj-reload/reload-all
. As mentioned in the docstring it will only reload already loaded namespaces that have at least one var. The one var limitation is because I don't know any other way of getting the files to all namespaces, but I also think this is not an important limitation since reloading a namespace with no vars isn't probably useful.There are a couple of small changes to the existing code like :
clj-reload.core/ns-load
work on resources urls as well as files.clj-reload.parse/read-file
try catch on the implementation signature, so both sigs are coveredclj-reload.util/ns-load-file
require only a file-name instead of a ^File objectI don't expect this to be merged as is but we have something to start with.