Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defprotocol ExtMetaProtocol
:extend-via-metadata true
(ext-meta-protocol [x]))
(ext-meta-protocol (with-meta {} {`ext-meta-protocol (fn [_] 1)})) ;;=> 1
(extend-type clojure.lang.PersistentArrayMap
(ext-meta-protocol [m]
(ext-meta-protocol {}) ;;=> 2
(ext-meta-protocol (with-meta {} {`ext-meta-protocol (fn [_] 1)})) ;;=> cljs => 2, clj => 1

This comment has been minimized.

Copy link

@jafingerhut jafingerhut commented Sep 1, 2019

Confirmed that Clojure 1.10.1 and ClojureScript 1.10.520 (at least with Node.js runtime) behave differently from each other in the way described above. For cljs the extend-type form must have clojure.lang.PersistentArrayMap replaced with the cljs equivalent cljs.core.PersistentArrayMap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.