This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-04
Channels
- # bangalore-clj (3)
- # beginners (23)
- # boot (89)
- # cider (11)
- # cljs-dev (22)
- # cljsjs (5)
- # cljsrn (21)
- # clojure (141)
- # clojure-android (1)
- # clojure-berlin (1)
- # clojure-greece (1)
- # clojure-italy (13)
- # clojure-mke (2)
- # clojure-nl (8)
- # clojure-norway (5)
- # clojure-russia (22)
- # clojure-sg (4)
- # clojure-spec (38)
- # clojure-uk (109)
- # clojurescript (150)
- # consulting (4)
- # core-async (7)
- # cursive (13)
- # datascript (8)
- # datomic (72)
- # dirac (185)
- # emacs (5)
- # figwheel (2)
- # flambo (1)
- # hoplon (13)
- # immutant (6)
- # lambdaisland (7)
- # lumo (46)
- # off-topic (13)
- # om (4)
- # onyx (1)
- # pedestal (1)
- # re-frame (68)
- # reagent (15)
- # rum (16)
- # slack-help (4)
- # spacemacs (22)
- # specter (3)
- # vim (10)
- # yada (28)
It seems that type hints get ignored on any js/...
interop. Is that intended?
;; 1. boolean is ignored:
(fn []
(or ^boolean js/window.x
false))
;; 2. Works:
(fn []
(or ^boolean window.x
false))
;; 3. Works:
(fn []
(or ^boolean (.-x js/window)
false))
the :infer-externs
code changed that behavior. there was a conversation about this before but I can't remember specifics
I think @darwin encountered this with ^boolean js/goog.DEBUG
and the gist of it was to use ^boolean goog/DEBUG
since goog
is implicitly imported
Oh, ouch. ^boolean js/goog.DEBUG
doesn't work any more?
If so, isn't that going to silently break the prod builds for projects which use that construct to inject dev-time features. We certainly do that.
We can obviously go through and take off the leading js/
... but its deadly if it silently changes behavior.
We'll test it and report what we find
Is this a recent change?
Just wondering how far back we'd have to go to find it working (if indeed it is now broken)
https://github.com/clojure/clojurescript/commit/0560106fe8576fd7029d86e61be09cd1f246bfe0 that seems to be it
@thheller is correct, I ran into it here: https://github.com/binaryage/cljs-devtools/commit/4e368408986bf739b56aad64e064b854fd7989d2
@mikethompson I would recommend having tests setup to check that expected DCE happened in advanced builds, the changes/regressions could be caused by Closure Compiler as well
@mikethompson user supplied type hints should supercede any thing the compiler infers so just a bug - file a report