I think this might be rehashing some old stuff, but I haven't seen discussion on it recently and I see this behavior is still present in 1.7 so I thought I'd ask. It's the same underlying issue as this: http://dev.clojure.org/jira/browse/CLJ-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel#issue-tabs
Having pr-str binding to the same *out* that's used by printing seems dangerous - is there a more commonly accepted standard way to serialize for edn? We've been using Clojure in production at ReadyForZero for 4 years and haven't encountered this, but began using a lib that uses edn, and stumbled on unexpected behavior (described below). Thanks guys. ignacio Just for other's sake, here is simplified code that demonstrates the surprising behavior we encountered. The real code is nested several levels and so was not as easy to spot. EXPECTED: app.core.redirect-service> (def _xs (map #(lg/warn (pr-str {:x "test" :y %})) [1 2 3])) #'app.core.redirect-service/_xs app.core.redirect-service> _xs ;; Force evaluation (nil nil nil) output on log: WARN nREPL-worker-69 20150623 220028,098 app.core.redirect-service ] {:x "test", :y 1} ;; "test" correctly printed w/ quotes, serialized as string WARN nREPL-worker-69 20150623 220028,099 app.core.redirect-service ] {:x "test", :y 2} WARN nREPL-worker-69 20150623 220028,099 app.core.redirect-service ] {:x "test", :y 3} UNEXPECTED: app.core.redirect-service> (def _xs (map #(lg/warn (pr-str {:x "test" :y %})) [1 2 3])) #'app.core.redirect-service/_xs app.core.redirect-service> (lg/warn _xs) ;; Force evaluation, but bind to *out* nil output on log: WARN nREPL-worker-69 20150623 220044,748 app.core.redirect-service ] {:x test, :y 1} ;; "test" incorrectly printed w/out quotes, serialized as symbol WARN nREPL-worker-69 20150623 220044,749 app.core.redirect-service ] {:x test, :y 2} WARN nREPL-worker-69 20150623 220044,749 app.core.redirect-service ] {:x test, :y 3} WARN nREPL-worker-69 20150623 220044,750 app.core.redirect-service ] (nil nil nil) >>> -- 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. For more options, visit https://groups.google.com/d/optout.