Hey guys,

I ran into this last night when trying to port some ancient JS in our project over to cljs. I was defining an om component called "users-typeahead", and in the (did-mount ...) implementation calling a bare javascript function called js/users_typeahead. At the repl, the latter worked great; INSIDE the did-mount implementation, js/users_typeahead resolved to a reference to the enclosing function itself.

My expectation was that, with Clojurescript's namespacing, js/func_name would always resolve to the top-level global namespace. Instead,

Here's a minimal reproduction:

(.log js/console "Hi!")
;; logs "Hi!"

(defn console [s] (.log js/console s))

(console "Hi!")
;; throws Compilation error: TypeError: undefined is not a function

What do you think? Expected behavior, or just an edge case to avoid?

--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com <http://www.paddleguru.com/>
Twitter <http://twitter.com/paddleguru>// Facebook <http://facebook.com/paddleguru>

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to