clojure.main sets the thread context classloader to be a DynamicClassLoader, providing an environment to tap into the Clojure classloader environment. prepl should do the same. This would support things like add-lib when using prepl (for tools like REBL that use prepl).
Repro with rebl and add-lib...
Same problem also exists with clojure.core.server/repl, provided for use in a socket server.
Approach: Create a macro `with-dynamic-loader` that ensures (and doesn't replace if it exists) the thread context classloader, evaluates the binding, then reverts the loader. This macro is generic and could potentially be moved elsewhere.