clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
salam 2020-04-19T01:47:54.163500Z

@alexmiller It seems like the Clojure Spec 1 alpha JAR is compiled against Java 1.5 (class file version 49). Is that intentional? It seemed a bit odd now that Clojure itself targets Java 1.8 (class file version 52).

alexmiller 2020-04-19T01:48:39.163900Z

Which version in particular?

salam 2020-04-19T01:50:04.164700Z

this is what's on my class path: spec.alpha-0.2.176.jar

salam 2020-04-19T01:51:57.166100Z

i took a look at the pom.xml (https://github.com/clojure/spec.alpha/blob/master/pom.xml) file for spec.alpha and the absence of <target.version>1.8</target.version> in the <properties> section seems to confirm that.

alexmiller 2020-04-19T01:52:50.167100Z

Iā€™m not at a computer but certainly older versions of the parent pom could have produced that

salam 2020-04-19T01:55:58.169200Z

I see. I was experimenting with https://openjdk.java.net/jeps/310 and noticed the following warning and figured I should at least let you know:

OpenJDK 64-Bit Server VM warning: Pre JDK 6 class not supported by CDS: 49.0 clojure/spec/alpha/Spec
Preload Warning: Cannot find clojure/spec/alpha/Spec

alexmiller 2020-04-19T01:58:14.170Z

There is a newer version that I suspect is newer bytecode. - 0.2.187

alexmiller 2020-04-19T02:00:14.172Z

Spec was introduced in the same release that bumped to java 1.8 bytecode and it took a while for the contrib libs to catch up

salam 2020-04-19T02:04:54.174100Z

ah, i see. it appears that the release version 1.10.1 of the clojure.jar still depends on the version that i have: https://search.maven.org/artifact/org.clojure/clojure/1.10.1/jar

alexmiller 2020-04-19T02:33:51.175100Z

You can add an explicit dependency on the newer spec.alpha version to override

salam 2020-04-19T02:35:03.175800Z

yep, i'll go with that. thank you.

salam 2020-04-19T03:17:50.177Z

ok, reporting back here. it turns out [org.clojure/spec.alpha "0.2.187"] is compiled against java 1.5 as well.

seancorfield 2020-04-19T04:27:34.178100Z

Confirmed, if I'm reading this right. class version 49 for spec.alpha 0.2.187, but class version 52 for clojure itself. The latter is Java 8.

practicalli-john 2020-04-19T08:13:06.182100Z

spec version 1 or version 2, that is the question šŸ™‚ My default assuming is spec 1 I am starting a new project, which I will mainly use spec for data structures I design and pass to functions as arguments. Its a data science visualisation project so there is a lot of data. I will also write specs for the functions that for the API for each namespace. Just checking that I am not missing an obvious benefit of using spec 2. Thank you.

mpenet 2020-04-19T08:38:13.184600Z

1 for sure. v2 seems still wip, especially fn annotations which apparently will be improved/modified

šŸ‘ 1
2020-04-19T08:38:17.184700Z

Spec 2 is experimental and subject to breaking change

2020-04-19T08:38:30.185Z

So unless you are doing this for fun, go with Spec 1

šŸ‘ 1