I am trying to create a multimethod that will dispatch on object hierarchies.
If an object implements a specific protocol or type then that multimethod will
be called. These multimethods work perfectly in Clojure, however, I am running
into problems with cljs. These problems occur due to the fact that the parents
function does not return the parents for an cljs object. This is shown below:
;; in clojure
(parents (class '()))
=>
#{clojure.lang.IPersistentList
clojure.lang.Obj
java.util.List
clojure.lang.IHashEq
clojure.lang.ISeq
clojure.lang.Counted}
;; in clojurescript
(parents (type '()))
=> nil
Example of the exact use-case:
(defmulti my-method #?(:clj class
:cljs type))
(defmethod my-method #?(:clj ISeq
:cljs IndexedSeq ;; Really should be ISeq again as this
does not work in the general case
)
[elem]
;; do stuff
)
Is there a different way to accomplish what I am trying to do or is this a bug?
Thanks for the help.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.