We're updating the issue view to help you get more done. 

Local bindings conflict with global JS namespace

Description

Not sure if it's a bug or expected behaviour, but this:

1 2 3 4 (defn test-fn [] (let [href js/location.href location "123"] href))

gets compiled to this (not in advanced mode):

1 2 3 4 5 cognician.chat.ui.pages.insights.test_fn = (function cognician$chat$ui$pages$insights$test_fn(){ var href = location.href; var location = "123"; return href; });

and local location var shadows global I'm trying to access in location.href.

That sort of thing is expected and one should pay attention and work around stuff like this in JS, but in CLJS it's very confusing because nothing hints what am I doing wrong and why that code fails. I remember one of ClojureScript goals was to fix JS semantics, so maybe there's a way this might be addressed? At least throw a warning, maybe?

Environment

None

Status

Assignee

Unassigned

Reporter

Nikita Prokopov

Labels

None

Approval

None

Patch

None

Priority

Minor