`*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 Philos Kim <philo...@gmail.com> wrote: > 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.io.PrintWriter@6957ec80 > "] > > > I expected the result to be "xyz" but the result of *out* doe not change > at all > > Can anyone explain to me why? > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/clojure/23d13e9b-6eb8-4a39-b00d-8fead541e18en%40googlegroups.com > <https://groups.google.com/d/msgid/clojure/23d13e9b-6eb8-4a39-b00d-8fead541e18en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CADQBrARn_ysTOsvk-CVrekb69k-ZMyxmNa%2BEcMZB_kabCykLKw%40mail.gmail.com.