This is a stopgap measure that will inform our approach in other related issues. #80 -- in CLJS -- the page requires a refresh in order for changes to rules to take place.
The bigger issue for me is that when I change a rule's name, I now have two rules. This occurs in both CLJ and CLJS. Our approach needs to be slightly different for each case.
That issue appears to stem from Clojure's semantics for "load-file" and others, where defs are added to the namespace but never removed except explicitly (by a programmer) ns-unmap. I have played with clojure.tools.namespace.repl/refresh but it seems to mess things up generally and reloads/refreshes more than we intend. I think we can do better, although our implementation may be similar to refresh at first.
I'm in the middle of adding a function that, when evaluated, removes all rules in namespace provided. This way, a subsequent load-file will add everything defined in the file, at which point we will have synced with reality.
This is somewhat of a glorified ns-umap, but it's better than what we currently have by a lot. We should be able to keep it at the top of a file and load the file repeatedly. This isn't ideal -- it should be integrated -- but I've failed to achieve this thusfar (the rules load before the session, so unmapping them inside the session results in a session with no rules).
Because the functionality is so important for developer experience we will roll this out ASAP even though the aesthetics and convenience aren't to the level we want.
This has important implications for defines, which we are prioritizing enhancements and fixes for as well.
I'll open a CLJS specific issue shortly once I'm confident on the plan there.
This is a stopgap measure that will inform our approach in other related issues. #80 -- in CLJS -- the page requires a refresh in order for changes to rules to take place.
The bigger issue for me is that when I change a rule's name, I now have two rules. This occurs in both CLJ and CLJS. Our approach needs to be slightly different for each case.
That issue appears to stem from Clojure's semantics for "load-file" and others, where defs are added to the namespace but never removed except explicitly (by a programmer)
ns-unmap
. I have played withclojure.tools.namespace.repl/refresh
but it seems to mess things up generally and reloads/refreshes more than we intend. I think we can do better, although our implementation may be similar torefresh
at first.I'm in the middle of adding a function that, when evaluated, removes all rules in namespace provided. This way, a subsequent
load-file
will add everything defined in the file, at which point we will have synced with reality.This is somewhat of a glorified ns-umap, but it's better than what we currently have by a lot. We should be able to keep it at the top of a file and load the file repeatedly. This isn't ideal -- it should be integrated -- but I've failed to achieve this thusfar (the rules load before the session, so unmapping them inside the session results in a session with no rules).
Because the functionality is so important for developer experience we will roll this out ASAP even though the aesthetics and convenience aren't to the level we want.
This has important implications for defines, which we are prioritizing enhancements and fixes for as well.
I'll open a CLJS specific issue shortly once I'm confident on the plan there.