Clojure 1.13.0-alpha1 Adds Checked Destructuring Keys
Clojure 1.13.0-alpha1 introduces checked keys for map destructuring, a larger threshold for keyword-only PersistentArrayMaps, and removes ACC_FINAL from static initializers.
Clojure 1.13.0-alpha1 is out, and it brings a handful of quality-of-life improvements for working engineers. The headline feature is checked keys in map destructuring — a long-requested ergonomic upgrade that finally lets you enforce required bindings without boilerplate.
Checked Keys: :keys!, :syms!, :strs!
You can now use the bang variants of the destructuring directives — :keys!, :syms!, and :strs! — to throw an exception if a specified key is not present in the map. This eliminates the need for manual get calls or pattern-matching workarounds when you want to guarantee that a required key is bound. Additionally, you can now include keys after & in any directive for documentation or validation purposes without binding them. The feature is tracked in CLJ-2961 and comes with accompanying specs (CLJ-2960).
A related utility, req!, is a variant of get that reports when a key is not found (CLJ-2949). Also, let, loop, and let* now disallow & as a local binding name (CLJ-2954), preventing a subtle footgun.
PersistentArrayMap Threshold Bumped
PersistentArrayMaps composed solely of keyword keys now grow up to size 64 (previously 8) before converting to PersistentHashMaps. Since PAM identity scans are more efficient than PHM lookups in this range, this change makes more usage sites monomorphic and easier for the JIT to optimize. A small but welcome win for hot paths.
Bytecode Baseline Prep
The ACC_FINAL designation has been removed from static initializer constants (CLJ-2891). This is a preparatory step toward moving the Java bytecode baseline to address new verifier checks — not user-facing yet, but signals where the runtime is headed.
Getting It
Update your deps.edn dependency:
org.clojure/clojure {:mvn/version "1.13.0-alpha1"}Or start a REPL with the Clojure CLI:
clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha1"}}}This is an alpha release, so expect more polish before the stable cut. The checked keys feature alone makes it worth a look if you've ever wished for destructuring that actually enforces presence.
Discussion
0 Comments
Be the first to start the discussion.