This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-15
Channels
- # announcements (15)
- # babashka (8)
- # beginners (23)
- # biff (20)
- # calva (6)
- # cider (9)
- # clerk (31)
- # clj-kondo (3)
- # clj-otel (2)
- # clojure (116)
- # clojure-argentina (1)
- # clojure-austin (5)
- # clojure-europe (64)
- # clojure-nl (3)
- # clojure-norway (23)
- # clojure-sweden (40)
- # clojure-uk (1)
- # cursive (16)
- # data-science (2)
- # datahike (8)
- # emacs (3)
- # events (1)
- # hyperfiddle (24)
- # malli (5)
- # off-topic (24)
- # re-frame (9)
- # releases (1)
- # solo-full-stack (25)
- # sql (18)
- # tree-sitter (19)
- # xtdb (10)
is it intentional that next.jdbc/with-transaction
only supports literal maps for opts
? When I try to pass a var, I get this:
> opts - failed: map? at: [:binding :opts] spec: :next.jdbc.specs/opts-map
Try it without instrumentation. I think that may just be a bug in the spec.
afaik I'm not instrumenting 🤷
Yes, you are. That spec check only happens if you have instrumentation enabled.
I know, but there's nowhere in the code base that should be instrumenting right now. Going to have to track down what's doing that
I've had a couple of reports over the years that a few of the specs in next.jdbc
are overly strict. You're the first one to report with-transaction
's spec tho'...
wait, doesn't Clojure itself now check macro specs automatically?
Only core stuff. Because of clojure.core.specs.
Hmm, maybe you're right... I'm... surprised by that... I thought you needed to explicitly call instrument
to turn on checking but it does look like macro expansion checks some level of fdef
if it is present.
Yup, confirmed!
Clojure 1.12.0-alpha4
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/fdef foo :args (s/cat :a int?))
user/foo
user=> (defmacro foo [a] `(* ~a ~a))
#'user/foo
user=> (foo 1)
1
user=> (foo "2")
Syntax error macroexpanding user/foo at (REPL:1:1).
"2" - failed: int? at: [:a]
user=> (let [x 1] (foo a))
Syntax error macroexpanding user/foo at (REPL:1:12).
a - failed: int? at: [:a]
user=>
TIL...
OK, I'll open a bug against next.jdbc
to fix that -- and I'll double-check any other macros in there that have specs...
that's a TIL for me too. And thank you!
OK, fix is in https://clojars.org/com.github.seancorfield/next.jdbc/versions/1.3.999-SNAPSHOT (or you can depend on the develop branch via git deps).
awesome, thanks for the super-quick turnaround
I'm embarrassed by both the bug and my misdiagnosis of your issue 😕
no worries! Just glad I wasn't going crazy