Closed lread closed 6 months ago
Ok, did a little poking. It seems that the issue is that the org.clojure/spec.alpha
v0.4.233 min Clojure version is 1.10. I think we are running into the effect of this change.
symbol
got smarter in Clojure 1.10 beta 5:
symbol
can now be passed vars or keywords to obtain the corresponding symbol
Let's do a little test in Clojure 1.10:
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.3"}}}'
Clojure 1.10.3
user=> (def foo 42)
#'user/foo
user=> (symbol #'foo)
user/foo
And if we repeat this in Cloure 1.9:
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}}'
Clojure 1.9.0
user=> (def foo 42)
#'user/foo
user=> (symbol #'foo)
ClassCastException class clojure.lang.Var cannot be cast to class java.lang.String (clojure.lang.Var is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') clojure.core/symbol (core.clj:579)
org.clojure/spec.alpha
to 0.3.218
.I think option 1 seems reasonable for now. There's (not yet) a version of Clojure that brings in the newest version of spec.alpha (we can assume 1.12 will do so eventually):
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}}' -Stree
org.clojure/clojure 1.9.0
. org.clojure/spec.alpha 0.1.143
. org.clojure/core.specs.alpha 0.1.24
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.2"}}}' -Stree
org.clojure/clojure 1.11.2
. org.clojure/spec.alpha 0.3.218
. org.clojure/core.specs.alpha 0.2.62
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha9"}}}' -Stree
org.clojure/clojure 1.12.0-alpha9
. org.clojure/spec.alpha 0.3.218
. org.clojure/core.specs.alpha 0.2.62
What happens if we remove clojure and spec from deps.edn? Presumably these are always provided already by clojure cli, or declared by the project. And the project's Clojure dependency would then determine which spec version gets included.
In my opinion, you should definitely remove the spec.alpha dependency and rely on getting that transitively via whatever Clojure version you use. Whether you remove Clojure itself as a dep is harder to say for certain, depends whether you have some Clojure version needs.
My assumption that kaocha depends on spec.alpha for some good reason is probably wrong. I had a wee peek at the kaocha deps.edn
history. It looks like the spec.alpha dep has been explicitly there almost from the beginning, probably for no good reason.
If memory serves, a wise man once told me that a lib can express its minimum supported Clojure version by its clojure dep. So if kaocha were to include a dep on clojure, it should probably be 1.9.0.
That seems reasonable
I dropped both dependencies, we can put the clojure dependency at 1.9, but then we have to manually hold it back each time we run antq. That's extra work and chance of forgetting for little benefit. The README clearly states the minimum supported version.
Thanks @plexus!
After upgrading to kaocha 1.88.1376, I noticed that tests that I run against Clojure v1.9 fail.
Test Environment
OS: Linux PopOS! JDK: Tried under 8 and 21, same result.
Minimal Repro
In an empty folder create
deps.edn
:Then run:
Expected Behaviour
I should see the normal warnings from kaocha, like:
Actual Behaviour
An exception is printed to the terminal:
Notes
If I bump
deps.edn
clojure version to1.10.3
same test gives expected behaviour.Leaving clojure version at
1.9.0
and downgrading kaocha to the previous release of1.87.1366
also results in expected behaviour.