[CLJS-420] Unexpected behavior with dispatch on Keyword via protocols Created: 18/Nov/12 Updated: 18/Nov/12
At the moment if you create a protocol and expect it to be able to dispatch on keywords you need to do it in js/String, trying to extend on cljs.core.Keyword doesn't work as keywords are just Strings.
|Comment by David Nolen [ 18/Nov/12 3:14 PM ]|
This is a known issue which will have to wait for if and when Keywords and Symbols become proper types in ClojureScript.
Extending js/Object is not recommended, if you actually need to add functionality to the base JS native types the convention is different from Clojure: default instead of Object, string instead of js/String. Please refer to core.cljs if you want more examples.
|Comment by Max Penet [ 18/Nov/12 3:27 PM ]|
Thanks for the pointer about default and string, I didn't know about that.
I reported the issue at the demand of bbloom. It does seem to be difficult to address without taking a (major) performance hit unfortunately.