Re: [?] alter-var-root and *out*

2021-09-01 Thread Benedek Szilvasy
You are altering the root binding, rather than the current (possibly dynamic) binding of the variable. The two may be distinct, since the current bindings may be thread local, such as by `clojure.core/binding` (see https://clojure.org/reference/vars). Note that you can `alter-var-root` of non-dyna

Re: [?] alter-var-root and *out*

2021-09-01 Thread Paul Stadig
`*out*` may have a thread binding established. REPLs will often do this. If `*out*` is thread bound you should be able to use `thread-bound?` to check that and then `set!` to set it, but you have to be careful because https://clojure.atlassian.net/browse/CLJ-1077 On Wed, Sep 1, 2021 at 4:58 AM Ph

[?] alter-var-root and *out*

2021-09-01 Thread Philos Kim
I can change my dynamic var with alter-var-root like this. (def ^:dynamic *x* "abc") (alter-var-root #'*x* (constantly "xyz")) *x* ; => "xyz" However, I cannot change *out* with alter-var-root. (alter-var-root #'*out* (constantly "xyz")) *out* ; => #object[java.io.PrintWriter 0x6957ec80 "java.i