This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-20
Channels
- # admin-announcements (1)
- # beginners (17)
- # boot (22)
- # cider (43)
- # cljs-dev (6)
- # cljsjs (2)
- # clojure (29)
- # clojure-austin (7)
- # clojure-estonia (1)
- # clojure-russia (62)
- # clojure-sg (1)
- # clojurebridge (2)
- # clojured (1)
- # clojurescript (89)
- # datomic (8)
- # hoplon (333)
- # jobs (3)
- # ldnclj (2)
- # leiningen (10)
- # luminus (1)
- # off-topic (9)
- # om (46)
- # proton (4)
- # re-frame (13)
- # reagent (29)
- # yada (11)
I'm super stumped, debugging, I've gotten down to this simple line of code that doesn't work as expected under advanced compilation:
(js/console.log (.-hey (clj->js {:hey "please work!"})))
prints out undefined
any idea what's up?
@josh.freckleton: I wonder how it would know not to rename .-hey
relative to the keyword :hey
which won’t be renamed. Interesting.
Ya, I'm assuming it's a renaming issue, but I have no idea how to deal with it... Thoughts?
@josh.freckleton: If the name “hey” is stable, perhaps externs would solve it.
The problem is in some interop with D3. It expects JS objects, which is why I'm using clj->js
...
@josh.freckleton: So, in short :advanced
is going to party on the symbol .-hey
, but it won’t muck with ”hey”
.
@josh.freckleton: The externs mechanism is designed to deal with this. See, for example https://github.com/federico-b/d3-externs
Hm, I understand that aget
is a little slower, and more meant for accessing dynamically created vars, no? Is there no more-idiomatic way? (and good call on d3 in cljsjs, that's what I'm using :))
@josh.freckleton: Hmm… gotta run, but that’s what the externs should be doing for you. Unless your symbol .-hey
isn’t a stable symbol or somehow not covered in the externs.
thanks for your help Mike, you've given me enough to probably solve this
@josh.freckleton: It may also make sense to check out :pseudo-names
to confirm that it really is a renaming issue: https://github.com/clojure/clojurescript/wiki/Compiler-Options#pseudo-names