Clojure 1.10.1-beta1

The big news this week is the release of Clojure 1.10.1-beta1. This is a tightly scoped release and we are not expecting to add much, if anything, more to it before it’s released. There are three items included in beta1:

1) CLJ-2484 - this ticket is about the performance regression seen as of Java 1.8u202 and Java 11.0.2. The changes in Java affected JIT optimization of a Java class static initializer when it calls back into static methods of the not yet initialized class. Clojure happens to typical this severely when loading user.clj in the static initializer of the clojure RT (runtime) class.

The patch in CLJ-2484 splits the user.clj load out of the RT static initializer and instead calls it explicitly in various load paths. While we believe we have covered all the main load paths, there may be some unusual load paths we have not considered, particularly via Java interop or AOT classes. If you’ve experienced performance issue with the latest Java builds OR if you have unusual startup paths, please give 1.10.1-beta1 a try!

2) CLJ-2463 - this ticket is a rework of the error handling for clojure.main when called as a runner (rather than as a REPL). The default behavior in these cases has always been to throw an uncaught exception. The JVM will print the exception message and stack trace. This was a set of cases that we did not consider in Clojure 1.10 where we focused primarily on the message that appears at the REPL during development.

CLJ-2463 changes the behavior in this case catch the exception, format and print the message based on the work we did in 1.10, and NOT print the stack trace. Instead, the exception data and stack trace will be printed to a temp file and the error output will point to the location of the file for more data. In the case of reader, compiler, or macroexpansion errors (broadly, syntax problems, including macro spec errors), the stack trace is in the Clojure compiler or other machinery, not in your code, and generally is not useful in most cases. In other cases, the top relevant line of the stack trace is reported in the message (as it is in the REPL). In cases where you want to force printing to stderr, there is a new flag on clojure.main, --report-stderr .

This is a significant change in the user experience of clojure.main when used as a runner. You may be thinking that this use case is not one that applies to you, but it probably does. Leiningen shells out to clojure.main when doing many tasks, like compilation, testing, running a ring server, etc.

We would greatly appreciate it if you can take the time to use Clojure 1.10.1-beta1 (particularly if you have been using Clojure 1.10.0 as there are almost no other changes in this delta likely to affect you) and give us feedback on the experience.

3) CLJ-2491 - Java 12 was released this week and while Clojure itself works fine under Java 12, there were a few brittle tests in Clojure that prevented a clean test run. This ticket fixes those tests and makes them more robust to future changes so we can add Java 12 to our test matrix.

We are not planning to add much else, if anything, to Clojure 1.10.1. This will be a very small release focused on the issues above. We would love to have eyes on these changes early, rather than late. Thanks!

Odds and ends

This week, Cognitect announced that we will be focusing our conference efforts on Clojure/conj and adding financial and other support to the great set of Clojure conferences that have sprung up around the globe. It’s fantastic that the community has grown to a point where we have many great events. Let all the confs bloom!

I worked on a bunch of other Clojure jiras this week, nothing worth going into details this week.

And Rich and I did some design work on s/schema for spec 2, which will also drive some changes in s/select. In between the stuff above, I am working on that, hopefully available relatively soon!

Other stuff I enjoyed this week…

New trailer for Stranger Things 3! Can’t wait!!