As a new user to ClojureScript who has not programmed in Clojure or any
JVM-to-JS environment this comes to me as a huge surprise!

(it shouldn't if I had thought things more deeply, but don't have the
luxury of infinite ramp up time)

user=> (def f {"a" "1" "b" "2"})

user=> (map #((name (key %))) f)

ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
user/eval1212/fn--1213 (b43f5f5d46b2bd87480559901c3a9d087879416a-init.clj:1)

>>> Is that a Java/Clojure Interop error? I suppose if the REPL throws then
I'll also see this error or a variant of it IN THE BROWSER ?

The error is resolved if I do this

(map #(str (name (key %))) f)

I thought Clojure is dynamically typed and I understand for Java interop on
the server if we have to do this but why couldn't we get away with it in
the browser environment?

My limited understanding is that str here is like String(val) in JS, which
is almost never needed.


Please enlighten, whomever understands the interop stuff and why as front
end developers we have to carry that burden?

-- 
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 http://groups.google.com/group/clojurescript.

Reply via email to