Skip to content

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

Open
@camsaul

Description

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?.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions