Thank you for your response.
The reasons why I didn't use protocols are following.
1.
Currently ClojureScript doesn't have `extend`, which makes inheritance
easy.
http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure
2.
I think an entity which is created by deftype or defr
If you are dispatching on types, use protocols. It's much faster.
Luc P
> I've experienced rewriting my ClojureScript code into multimethods
> base.
> I'd share my results.
>
> Initially I implemented polymorphism behavior as simple hashmap like
> this:
>
> (def parent
> {:foo (fn [x] ...)
If you are only dispatching on a single type - I think protocols will
always be much faster than multimethods.
I think that you only really want to use multimethods if you need to
dispatch on more than one type or on something that is not a type at all.
D
--
You received this message because
I've experienced rewriting my ClojureScript code into multimethods
base.
I'd share my results.
Initially I implemented polymorphism behavior as simple hashmap like
this:
(def parent
{:foo (fn [x] ...)
:bar (fn [x] ...)})
(def child
(merge parent {:foo (fn [x] ...)}))
For some reason