Created
August 31, 2019 07:07
-
-
Save cjohansen/a24257ecb5db15c7e20aaa25ff713b30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 | |
ExtMetaProtocol | |
(ext-meta-protocol [m] | |
2)) | |
(ext-meta-protocol {}) ;;=> 2 | |
(ext-meta-protocol (with-meta {} {`ext-meta-protocol (fn [_] 1)})) ;;=> cljs => 2, clj => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 haveclojure.lang.PersistentArrayMap
replaced with the cljs equivalentcljs.core.PersistentArrayMap
.