Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:keys destructuring is broken for unqualified keywords #293

Open
frenchy64 opened this issue Mar 3, 2025 · 0 comments
Open

:keys destructuring is broken for unqualified keywords #293

frenchy64 opened this issue Mar 3, 2025 · 0 comments

Comments

@frenchy64
Copy link
Contributor

frenchy64 commented Mar 3, 2025

; :keys is broken
clojure.core=> (let [{:keys [b] :as m} {:b :b}] [b m])
[nil {:b :b}]

; :strs and :syms are ok
clojure.core=> (let [{:strs [b] :as m} {"b" :b}] [b m])
[:b {"b" :b}]
clojure.core=> (let [{:syms [b] :as m} {'b :b}] [b m])
[:b {b :b}]

The problem seems to be the keyword :b is being converted to (clojure.core/get clojure_core-map-4419 :nil/b):

clojure.core=> (macroexpand-1 '(let [{:keys [b] :as m} {:b :b}] [b m]))
(let* [clojure_core-map-4419 {:b :b} clojure_core-map-4419 (if (clojure.core/seq? clojure_core-map-4419) (if (clojure.core/next clojure_core-map-4419) (clojure.core/into {} clojure_core-map-4419) (if (clojure.core/seq clojure_core-map-4419) (clojure.core/first clojure_core-map-4419) {})) clojure_core-map-4419) m clojure_core-map-4419 b (clojure.core/get clojure_core-map-4419 :nil/b)] [b m])
@frenchy64 frenchy64 changed the title :keys destructuring is broken :keys destructuring is broken for unqualified keywords Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant