Fork me on GitHub
#cljs-dev
<
2017-05-28
>
mfikes12:05:28

I finally figured out why we needed to qualify

`any?
(https://github.com/clojure/clojurescript/commit/61805334a521df6b865650741046e29bfda35b72) It turns out it is not related to self-host (syntax quote is not broken in self-host). If you are using (JVM) ClojureScript 1.9.562 in a project that also specifies Clojure 1.8.0, then, in a macro namespace, without qualifying, it will expand using the macro namespace’s name, to cljs.spec.alpha/any? (unless you perhaps have Tonsky’s clojure-future-spec at play). This is because any? doesn’t exist in Clojure 1.8.0. In short, without us qualifying that symbol, it would require ClojureScript 1.9.562 users to also use some pre-release version of Clojure 1.9.0 that includes that predicate (which I assume is not a requirement that ClojureScript wants to levy).

mfikes12:05:21

(The above applies in the case that you are using the shipping clojurescript-1.9.562.jar as apposed to cljs.jar, which includes Clojure.)

anmonteiro15:05:01

@mfikes so why doesn't it work in self-hosted?

anmonteiro15:05:21

I thought we had the new predicates in cljs.core

mfikes15:05:01

@anmonteiro My guess is that the failure was related to Planck using JVM ClojureScript in an early part of its compilation. I haven't tracked down this to be absolutely sure. But, I did reproduce the issue described above using only JVM ClojureScript. (I changed it back to unqualified, built the ClojureScript JAR, and used it directly in a minimal JVM-based ClojureScript project specifying Clojure 1.8.0.)

anmonteiro15:05:52

So if you change Planck to use Clojure 1.9 it starts working?

mfikes15:05:02

I suspect that Planck is simply compiling the Planck namespaces to ClojureScript, which use fdef, using JVM ClojureScript, at that point.

mfikes15:05:16

I can change Planck to use Clojure 1.9 and confirm the theory.

anmonteiro15:05:35

Hah. My understanding of the issue was wrong then. Thanks

mfikes15:05:05

It is definitely a new kind of failure mode, I don't recall us ever encountering before. 🙂

mfikes15:05:10

@anmonteiro Confirmed. If you set Planck to use Clojure 1.8.0, you get

WARNING: Use of undeclared Var cljs.spec.alpha/any? at line 34 src/planck/core.cljs
but with 1.9.0-alpha17, Planck's ClojureScript compiles.

mfikes15:05:54

(And the error above occurs in the early part of Planck's compilation, when it is using JVM ClojureScript to compile its namespaces.)