Fork me on GitHub
#cljs-dev
<
2019-07-09
>
anmonteiro21:07:26

We’re thinking about submitting this patch to CLJS which would allow to remove a check for defonce emission under advanced optimizations:

diff --git a/src/main/clojure/cljs/core.cljc b/src/main/clojure/cljs/core.cljc
index 2beaca2b..5d817106 100644
--- a/src/main/clojure/cljs/core.cljc
+++ b/src/main/clojure/cljs/core.cljc
@@ -618,7 +618,7 @@
   "defs name to have the root value of init iff the named var has no root value,
   else init is unevaluated"
   [x init]
-  `(when-not (exists? ~x)
+  `(when (or (not ^boolean goog.DEBUG) (not (exists? ~x)))
      (def ~x ~init)))

 (core/defn destructure [bindings]

4
anmonteiro21:07:40

wanted to bring it up here first to see if there’s anything that we’re missing

anmonteiro21:07:47

we’ve verified that Closure can remove the if that checks whether x is defined with the above patch, but not without