Clojure 1.10 upgrade supports modern Java

Functional JVM language offers more detail on programming errors

Clojure 1.10 upgrade supports modern Java
Eclipse Images / Getty Images

Clojure 1.10, an upgrade to 11-year-old language that has brought functional programming to the JVM, improves Java compatibility and error reporting.

While Clojure is best-known for its Java tie-in, it also has been extended to other platforms. Clojure CLR supports the language on Microsoft’s Common Language Runtime, while ClojureScript is a compiler that lets Clojure developers compile their code to JavaScript.

Where to download Clojure 1.10

You can download Clojure 1.10 from the Clojure downloads webpage.

What’s new in Clojure 1.10

Version 1.10 supports Java 8 through Java 11. It updates the module system introduced in Java 9, fixes bytecode-related bugs, and removes deprecated APIs.

Error reporting at the REPL (read-eval print loop) now categorizes errors based on the phase of execution, such as read, compile, and macroexpand. Additional information is provided about location and context as data. Phase-specific error messages are provided, with better location reporting. While this functionality is built into the clojure.main REPL, it also is available for other REPLs and tools, and developers can use and modify the data to produce improved error messages.

Other capabilities in Clojure 1.10 include:

  • defprotocol, used for defining a named set of methods and their signatures, has a new option, :extend-via-metadata. When this option is true, values can extend protocols by adding metadata where keys are qualified protocol function symbols and values are function implementations.
  • tap provides a shared system for distributing information or diagnostic to a set of handler functions. It can be used to debug the core prn capability or for facilities such as logging.
  • The read+string function mimics read but also captures the string that is read and returns both the read value and the read string.
  • A pre-beta version of Prepl provides a stream-based REPL with structured output, suitable for programmatic use.
  • The clojure/datafy facility for object-to-data transformation has the datafy and nav functions for transforming and navigating through object graphs.

Copyright © 2018 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!