I think the reason why we could redirect the *out* or *err* is that, all
Clojure functions staffs USE these 2 writers. But in places where it
doesn't (such as places where it uses System/out, System/err directly), it
would cause problem.

Here is a proof:
(with-out-str
          (with-open [out-writer (clojure.java.io/writer System/out)]
            (.write out-writer "hello")))
This statement returns empty string: ""
Which means the output is never captured because it does not use the *out*
writer.


2013/3/5 Jim - FooBar(); <jimpil1...@gmail.com>

>  I can see why you would think that but it would be the same story for
> *out* wouldn't it. Noone redirects System.out when you bind *out* to some
> writer, however still it works...
> I don't exactly have time to look into this now but I may do this
> afternoon :)
>
> Jim
>
>
> On 05/03/13 15:07, bruce li wrote:
>
> Thanks. Then I think I've caught some idea.
>
> When binding *err* with other writer (say a StringWriter s), anything that
> use the *err* writer will actually write to s. But the original stderr
> stream is not redirected. It is still preserved as System/err. Thus
> anything that does not use the *err* writer, but instead use the System/err
> stream will not get affected.
>
> Hope this makes sense.
>
> 2013/3/5 Jim - FooBar(); <jimpil1...@gmail.com>
>
>>  On 05/03/13 14:50, bruce li wrote:
>>
>> What is the difference between *err* and System/err?!
>>
>>  its the same but wrapped in a PrintWriter
>>
>>
>> http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/*err*
>>
>> Jim
>>
>>   --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to