clojure 2026-10-21

Reitit 0.7.2 crashes on Clojure 1.13.0-alpha9. No errors with latest Reitit or Clojure 1.12.

$ clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha9"} metosin/reitit-ring {:mvn/version "0.7.2"}}}' -M -e "(require 'reitit.ring) (println :ok)"
Syntax error compiling at (reitit/ring.cljc:235:43).
Unable to resolve symbol: path in this context

Full report at:
/tmp/clojure-11250786372418296841.edn

I expect it's using & as a binding in :keys somewhere...

Ah, no, it has defaults in :or that depend on other bound vars. That only ever worked by accident.

👍 1

[response-fn {:keys [parameter root path loader allow-symlinks? index-files paths not-found-handler]
                   :or {parameter (keyword "")
                        root "public"
                        index-files ["index.html"]
                        paths (constantly nil)
                        not-found-handler (if path ;; <==== not legal!!!
                                            (constantly nil)
                                            (constantly {:status 404, :body "", :headers {}}))}}]

It's fixed in 0.11.0 of reitit. Might be fixed in an earlier version...

0.8.0 fixed it.

👍 1

> clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha9"} metosin/reitit-ring {:mvn/version "0.8.0"}}
}' -M -e "(require 'reitit.ring) (println :ok)"
Downloading: metosin/reitit-ring/0.8.0/reitit-ring-0.8.0.pom from clojars
Downloading: metosin/reitit-core/0.8.0/reitit-core-0.8.0.pom from clojars
Downloading: metosin/reitit-ring/0.8.0/reitit-ring-0.8.0.jar from clojars
Downloading: metosin/reitit-core/0.8.0/reitit-core-0.8.0.jar from clojars
:ok

(current version is 0.11.0)

Nice! Thank you, @seancorfield. I didn't know who was to blame here. 🙏

It's "deliberate" insofar as it is guaranteed not to work in 1.13 but it worked sometimes in earlier versions (depending on map key ordering -- so folks generally reordered :or keys to make it work 🙂 ).

😄 1

clj-kondo also reports it, at least, it should

Alex Miller (Clojure team) 2026-10-21T15:50:03.116389Z

it's not guaranteed to work or not work in any version - the behavior of this is undefined

👍 2

o wait, perhaps it's already fixed in reitit, sorry

Alex Miller (Clojure team) 2026-10-21T15:56:42.704529Z

more generally, :or initial expressions should not depend on bindings from the same destructuring form (because the ordering of evaluation is undefined)

👍 1

@borkdude "perhaps it's already fixed in reitit" -- yes, I posted which version it was fixed in, if you unroll the whole thread 🙂

sorry about that, my bad

thanks for fielding this @seancorfield!