clojure-dev 2026-08-02

This looks like a gap in the :or implementation, or perhaps it's intentional?

$ clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha6"}}}' -M -e "(let [{:keys [& :x] :or {:x nil} :all m} {}] m)"
{} ;; should be {:x nil}?

$ clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha6"}}}' -M -e "(let [{:keys [& :x] :or {:x false} :all m} {}] m)"
{:x false}

ok fine, as long as I know this is deliberate.

this is for how I should make clj-kondo behave

Another edge case, perhaps: (let [{a nil :or {a 1}} {}] a) => 1

this last one says: bind a to the value in the map at the key nil (which can be a key), or if that key is missing, to 1. The nil key is missing in {}

👍 1

the first one looks like a bug, will look in a bit

user=> (let [{a nil :or {a 1}} {nil 42}] a)
42

@eval2020 anti-pattern or not, it's still valid. What I am saying there is not a rationale for that behavior

👍 2

@borkdude

user=> (let [{:keys [& :x] :or {:x nil} :all m} {}] m)
{:x nil}
in next release - thanks for the report!

🎉 6