For a socket repl, I'd like to have error output sent across the wire as well as normal output. Clojure currently provides vars (*in* and *out*) that allow a thread to redirect input and output. I suggest a new var *err* which allows redirecting error output as well.
I can mostly do this without a change to Clojure by using my own alternative to Repl.java, but there are several instances in Clojure where System.err is accessed directly. If those were made indirect through a new *err*, one could reliably redirect all of *in*, *out*, and *err*.
Here's the *err* definition I suggest for RT.java:
final static public Var ERR =
Var.intern(CLOJURE_NS, Symbol.create("*err*"),
new PrintWriter(new OutputStreamWriter(System.err, UTF8), true));
(A PrintWriter with auto-flush.)
I think PrintWriter is a good choice because Throwable offers a method to dump stack traces to a PrintWriter.
--Steve