clojure.walk/keywordize-keys and stringify-keys should not turn Records into maps

Description

The functions clojure.walk/keywordize-keys and stringify-keys do not respect Records. When called on a data structure, any Records in the data structure will be transformed into plain maps.

E.G.,

Environment

All

Activity

Show:
David Chelimsky
December 4, 2019, 5:10 PM
Edited

With this change:

user=> (stringify-keys {:a 1 :b 2})
{:a 1, :b 2, "a" 1, "b" 2}

So there would need to be a dissoc applied as well. One issue there is that dissoc on Records, when dissocing keys that are components of the Record, also returns a map instead of the Record.

Alex Miller
April 17, 2019, 2:23 PM

The proposed patch seems like it has other consequences for non-records. For example, sorted maps would retain their sortedness whereas they do not currently. That may or may not be desirable, but it's certainly a much broader change in behavior than that implied by the ticket.

Does the change in stringify-keys even work? Doesn't seem like it when eyeballing it and causes test failures when applied.

Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

Andrew Mcveigh

Labels

Approval

Triaged

Patch

Code

Priority

Minor