Share your thoughts in the 2024 State of Clojure Survey!

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

+3 votes
in tools.reader by

Maps written using the new #:default.namespace{,,,} syntax don't get file positions attached as metadata.

Given this setup code

(require '[clojure.tools.reader :as reader])
(require '[clojure.tools.reader.reader-types :as reader-types])

(defn sample [s]
  (with-open [r (java.io.StringReader. s)]
    (meta (reader/read (reader-types/indexing-push-back-reader (reader-types/push-back-reader r) 1)))))

this edn literal fails to get parsed with positional metadata

(sample "#:ns{ :key :val }") ; => nil

unlike those two, which get their positional metadata as expected

(sample "{ :key :val }")     ; => {:line 1, :column 1, :end-line 1, :end-column 14}
(sample "{ :ns/key val }")   ; => {:line 1, :column 1, :end-line 1, :end-column 16}

2 Answers

+1 vote
by
selected by
by
And Nicola fixed it right away and released a v1.3.6 with the fix. Thanks to both of you!
0 votes
by

Note: not a pressing issue for me anymore since I ended up switching to edamame, which doesn't have the bug, but Alex mentioned that he might file a ticket.

...