greenh / CJD

CJD is a system for documenting Clojure programs through the use of structured comments embedded in Clojure source code.
Other
12 stars 0 forks source link

Residual state being maintained across CJD executions in REPL #42

Closed greenh closed 11 years ago

greenh commented 11 years ago

CJD maintains lists of ancillary stuff (resolver functions, added resources like CSS documents, etc.) that are updated and added to by user-supplied extensions. These lists are part of CJD's global state, and they're added to at the time that CJD loads an extension.

This works well enough when running CJD in an environment where global state doesn't persist past a single execution, e.g., when running under lein or from the command line. For use from the REPL, however, "stuff" tends to build up across multiple executions, and the leftover state can cause incorrect or inappropriate results.

This isn't a matter of simply resetting the list content at the start of execution, as contents of extensions (and their transitive closure) are not in general reloaded, and hence a simple reset would result in "stuff" going missing.

Might be needful to separate extensions that are, in effect, scripts, from those that are pure code... and insist that all state additions are in the top-level, explicitly-specified scripts. Then, we'd do a reset on each execution to clean out the old stuff, and then unconditionally reload the script-things.

greenh commented 11 years ago

Fixed, we think.