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

def-map-type breaks in namespaces that shadow core Clojure methods like instance? #70

Open
camsaul opened this issue Jan 4, 2023 · 0 comments

Comments

@camsaul
Copy link

camsaul commented Jan 4, 2023

If you have a namespace that does something like :refer-clojure :exclude [instance?] and use def-map-type in it,

(merge instance-of-my-map-type nil)

will break because

def-map-type uses the def-abstract-type AbstractMap which defines cons like this:

(cons [this o]
(cond
(map? o)
(reduce #(apply assoc %1 %2) this o)
(instance? java.util.Map o)
(reduce #(apply assoc %1 %2) this (into {} o))
:else
(if-let [[k v] (seq o)]
(assoc this k v)
this)))

and the ultimate macroexpansion copies that call to instance? directly, rather than qualifying it as clojure.core/instance?.

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

2 participants