The function clj->js use "name" function to convert a keyword to a string, 
which is not the right choice, since "name" means a different thing from what 
should be placed here.

When we use ClojureScript in developement, as long as we need to deal with js 
object, we have to js->clj  (with keywordize true) first, so there can be 
strings like "A/B" in keys which are converted to :A/B. When converting them 
back to js object, :A/B will be converted to "B", which causes a lot of 
problems.



What I use is the one below, which does the correct conversion.

(defn keyword2string [k]
  (let [ky (if-let [nspace (namespace k)] (str nspace "/" (name k)) (name k))]
    (if (empty? ky)
      (subs (str k) 1)
      ky)))


I don't know whether it is a known issue (probably for a very long time...) I 
didn't see any fix in github, and I have no idea how to contribute to it. 

It's likely everyone else who encountered this problem before use some approach 
like defining their own version of clj->js (like me), but I guess it is not a 
good idea to leave a not so correct cljs.core function for the ones who hasn't 
encountered this problem yet.

Thank you~!

Nuo

-- 
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.

Reply via email to