Welcome! Please see the About page for a little more info on how this works.

+7 votes
in Printing by

Currently one can't send vars around in edn. #' is clojure reader specific. Objective is to transmit var identity and bind to same-named var on reading side (a la var serialization support).

Proposed: This is not generic enough to add to edn, so use #clojure/var for tag. Printing may print #clojure/var instead of #' (perhaps via a flag) - needs more assessment. #clojure/var tag reader should be installed in data readers.

Patch: vartag2.patch

4 Answers

0 votes
by

Comment made by: cgrand

Should unnamed vars (eg created by {{with-local-vars}}) print to 1. or throw an exception? (exception is the print-dup behavior)

0 votes
by

Comment made by: kunstmusik

I think the vartag2.patch has an issue in that the test for print-var-tagged in missing an assertion. I think it is supposed to have something like:

(is (and ...))

within the last let-binding.

0 votes
by

Comment made by: gshayban

Printing unnamed vars has little utility (nothing distinguishes them from each other without knowing their code context), seems like it would be fine to have 1. } or 1. }

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2165 (reported by alexmiller)
...