With Clojure 1.9-beta2, the reader and writer now support compact syntax for maps . The syntax allows you to avoid repeating the namespace in the case when all the keys are qualified keywords with the same namespace:
> (pr-str {:a/foo 1 :a/bar 2})
"#:a{:foo 1, :bar 2}"
This causes problems when sending such a serialized map to the Clojure 1.8 process: the old reader working there will not be able to read it and issue it java.lang.RuntimeException: Reader tag must be a symbol
.
Fortunately, the printer does this only when the dynamic variable is *print-namespace-maps*
true and false by default, so my application continues to work in production. However, the REPL sets it to true, so when I work in the REPL and do something that eventually sends a request to the Clojure 1.8 service, it crashes. How can I disable the new syntax in REPL as well?
I thought that maybe I could just (set! *print-namespace-maps* false)
add in my repl or add {:user {:repl-options {:init (set! *print-namespace-maps* false)}}}
to my ~ / .lein / profiles.clj, but that doesn't seem to work. I think the reason may be that the REPL uses binding
to create local stream bindings for a group of variables, including this one, and set!
doesn't work for local variable bindings .