It's either attached to this message or uploaded to the group as:

redirectable-stderr.patch

Thanks,

--Steve

Attachment: redirectable-err.patch
Description: Binary data



On Oct 6, 2008, at 8:42 PM, Rich Hickey wrote:

On Oct 6, 8:37 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
Rich,

Would you accept a patch to implement this?


Sure - thanks.

Rich

On Sep 30, 2008, at 12:25 AM, Craig McDaniel wrote:

Yes, I'd like to see *err* added too. I did my own *err* for a custom
REPL and was surprised it wasn't already part of the environment just
like *out*.

On Sep 29, 9:24 am, Thorsen Eric <[EMAIL PROTECTED]>
wrote:
I would love to see this change as well.

Eric

On Sep 28, 2008, at 1:28 PM, Stephen C. Gilardi wrote:

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

Reply via email to