Open an issue in JIRA.

Thanks!
David

On Mon, Aug 15, 2016 at 6:37 AM, Miroslav Kubíček <
miroslav.kubi...@gmail.com> wrote:

> Hi there!
> 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 adn
> all produce the same result:
> #cljs.user.MyRecord{:value "a"}
>
> On the other hand pprint just ignores the record's tag and simply just
> traverses/prints it as a map:
> {:value "a"}
>
> 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?
>
> THIS WORKS:
> cljs.user=> (defrecord MyRecord [value])
> cljs.user/MyRecord
> cljs.user=> (pr (MyRecord. "a"))
> #cljs.user.MyRecord{:value "a"}
> nil
> cljs.user=> (pr-str (MyRecord. "a"))
> "#cljs.user.MyRecord{:value \"a\"}"
> cljs.user=> (print (MyRecord. "a"))
> #cljs.user.MyRecord{:value a}
> nil
> cljs.user=> (print-str (MyRecord. "a"))
> "#cljs.user.MyRecord{:value a}"
>
> BUT THIS DOESN'T:
> cljs.user=> (cljs.pprint/pprint (MyRecord. "a"))
> {:value "a"}
> ("{:value \"a\"}\n")
> cljs.user=> (with-out-str (cljs.pprint/pprint (MyRecord. "a")))
> "{:value \"a\"}\n"
>
> Thanks for help!
>
> Cheers
> Miro
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to