Ah hm, yeah I'm surprised this isn't caught by the existing shadowing
and :js-globals logic. Sure open a ticket, patch welcome of course.

David

On Sun, Aug 3, 2014 at 6:23 PM, Herwig Hochleitner
<hhochleit...@gmail.com> wrote:
> To clarify on David's comment, js/console puts a literal 'console'
> identifier into the generated js.
>
> In your example, js/console is shadowed, because (defn console[] js/console)
> is emitted as ns.console = (function console(){return console;});
>
> The discussion to be had here is whether the (internal) name of the
> generated js function should e.g. be mangled like let-binding:
>
> ns.console = (function console_1337(){return console;});
>
> Ticket?
>
>
> 2014-08-01 15:07 GMT+02:00 David Nolen <dnolen.li...@gmail.com>:
>
>> js/foo does not resolve to the global namespace.
>>
>> David
>>
>> On Thu, Jul 31, 2014 at 9:42 AM, Sam Ritchie <sritchi...@gmail.com> wrote:
>> > 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
>> > Twitter // Facebook
>> >
>> > --
>> > 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.
>>
>> --
>> 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.
>
>
> --
> 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.

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