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

+40 votes
in Clojure by
closed by

Example:

user=> (set! *print-meta* true)
true
user=> (clojure.walk/postwalk identity ^:foo ())
()
user=> (clojure.walk/postwalk identity (with-meta (list 1 2 3) {:foo true}))
(1 2 3)

See JIRA issue: https://clojure.atlassian.net/browse/CLJ-2568
The JIRA issue was already there for a while. This ask issue was created so it can catch upvotes from the community. If you care, please upvote!

closed with the note: Released in 1.12.0-alpha8

2 Answers

+1 vote
by

It would be very helpful to see real examples where this matters - as we look into various tradeoffs it is difficult to understand use cases without more information about where you run into this.

by
One example is in edamame where I postwalk the body of a function literal. Because line numbers are dropped on lists / seqs (conses are not lists, but exist as a result of syntax quote) I needed to implement my own.

https://github.com/borkdude/edamame/blob/6ec811bee0d9a636e4e1eb87f9cf2aa1dd5d8518/src/edamame/impl/read_fn.cljc#L4-L24
by
I think all serious code processing with clojure.walk suffers from the metadata issue. It loses ^:tag, locations etc.
0 votes
by

Alex Miller
May 31, 2020 at 9:54 PM

Something to consider is whether existing code modifies coll metadata during walk and will thus be broken by this change.

That's a question, is there an answer ?

by
Updated in JIRA issue
...