prepl does not run with a DynamicClassLoader

Description

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...

deps.edn:

Actual:

Desired:

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.

Patch: clj-2540-2.patch

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Miller

Approval

Vetted

Patch

Code

Fix versions

Affects versions

Priority

Major
Configure