Clojure 1.13 alpha adds checked destructuring keys that fail fast on missing values
Clojure 1.13.0-alpha1 introduces checked variants of the map destructuring directives — :keys!, :syms!, and :strs! — that throw an exception when a required key is absent instead of silently binding nil. The release also lets developers list keys after & in any directive without binding them, giving a place to document or assert expected keys. Together these features let programs catch malformed maps at the destructuring site rather than debugging a nil that surfaces much later.
The alpha also carries a performance change to Clojure’s map internals: PersistentArrayMaps built from keyword-only keys now grow to 64 entries before promoting to PersistentHashMaps, up from the previous threshold of 8. Because linear identity scans over an array map beat hash lookups in that size range, and because more call sites stay monomorphic, the JIT has an easier time optimizing common map-heavy code.
Rounding out the release, CLJ-2891 strips the ACC_FINAL flag from static initializer constants as groundwork for raising the JVM bytecode baseline to satisfy newer verifier checks, and the runtime and test dependencies were bumped to current versions. None of this is production-final — it’s an early alpha aimed at developers who want to try the new destructuring ergonomics.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.