I am having troubles making the cljs pretty print (cljs.pprint/pprint) behave the same way as the regular cljs or clj print function when it goes down to tagged elements that are by default used to denote custom records.
See example below - pr, pr-str, print and print-str functions all use the default approach toward creating (edn-like) tagged element for MyRecord and all produce the same result:
On the other hand pprint just ignores the record's tag and simply just traverses/prints it as a map:
Is there some setting and/or parameter in cljs.pprint namespace I am missing? I looked briefly at the code, but it seems it uses print-str by default - so maybe it just traverses the graph depth-first and does not check for every node's type? At this stage this seems like a bug to me as the expected behavior of the pprint function is that it would behave the same way print and other core functions do.
cljs.user=> (defrecord MyRecord [value])
cljs.user=> (pr (MyRecord. "a"))
cljs.user=> (pr-str (MyRecord. "a"))
cljs.user=> (print (MyRecord. "a"))
cljs.user=> (print-str (MyRecord. "a"))
BUT THIS DOESN'T:
cljs.user=> (cljs.pprint/pprint (MyRecord. "a"))
cljs.user=> (with-out-str (cljs.pprint/pprint (MyRecord. "a")))
According to github the head revision of the cljs.pprint namespace has not changed since 1.7.28 so I'd assume all versions up to the current one are affected.
Thanks for help!