clj-commons

dgr 2025-09-13T23:16:21.033509Z

I had clj-kondo flag an error in my code the other day because I was using Slingshot to catch an exception and Slingshot doesnโ€™t come bundled with clj-kondo support. @borkdude helped me through what to do but mentioned that Slingshotโ€™s maintainer has passed away. I commented that given Slingshotโ€™s use in basically every Clojure web client because of its original use in clj-http (also used in, e.g., Aleph, Hato, etc.), it would be good if that library were maintained. @borkdude suggested that I suggest it for possible clj-commons support here. I think itโ€™s a widely used, important library that is relatively mature and would have a low maintenance cost going forward. Mostly, it should be evolved to keep it fitting in with the modern Clojure landscape, whatever that might happen to be at any point in time.

borkdude 2025-09-15T10:04:42.043009Z

here's another cute illustration of org changes and the problem it causes :) https://clojurians.slack.com/archives/CHY97NXE2/p1757930085239759?thread_ts=1757929848.860759&cid=CHY97NXE2

๐Ÿ‘ 1
dgr 2025-09-15T11:47:00.973589Z

In fact, that might be an issue. Given that itโ€™s used by all the HTTP libraries, it will get definitively sucked into projects that way.

seancorfield 2025-09-15T14:16:57.076819Z

Yeah, that's why it's important to change nses right out of the gate with this one!

๐Ÿ‘ 3
seancorfield 2025-09-14T17:36:46.327009Z

I've sent messages to Hiredman (Kevin Downey, mentioned in the README) and Alexander Gunnarson (who added cljs support). I'll fork Slingshot into clj-commons this week -- unless I hear any objections in the next day or two -- and get it setup with deps.edn and GitHub Actions and bb.edn like I did for durable-queue and how next.jdbc and HoneySQL work.

๐ŸŽ‰ 3
2025-09-14T17:42:01.771759Z

that's great news. i tried to update the repo to test above 1.8 and it currently fails lol

seancorfield 2025-09-14T17:48:06.220099Z

Ah, yes:

FAIL in (test-stack-trace) (support_test.clj:52)
expected: (re-find #"stack_trace_fn" className)
  actual: (not (re-find #"stack_trace_fn" "slingshot.support$stack_trace"))

seancorfield 2025-09-14T17:49:41.735799Z

Changing that test to this passes on 1.8 up to 1.12:

(is (re-find #"stack_trace(_fn)?$" className))

borkdude 2025-09-14T21:57:51.285529Z

would be nice to include the clj-kondo configs as part of this migration @seancorfield , as described in the original post

borkdude 2025-09-14T21:57:58.041079Z

if you need any help with that, let me know

seancorfield 2025-09-14T22:00:20.984509Z

Yup, that's part of my plan. One thing that I think I'll need help with is how to handle the extensions to assert-expr: thrown+? and thrown+-with-msg? -- since those only exist by virtue of is ๐Ÿ™‚

borkdude 2025-09-14T22:04:50.806609Z

so far the main config code is here: https://github.com/clj-kondo/configs/blob/main/configs/slingshot/slingshot/resources/clj-kondo.exports/clj-kondo/slingshot/clj_kondo/slingshot/try_plus.clj I've made an improvement to it very recently. the assert stuff can be supported by creating dummy vars for those which people can refer, even though it's not really necessary. like:

(require '[slingshot.test :refer [assert-expr])
(is (assert-expr ...))
The same solution was chosen for nubank's matcher combinator

โž• 1
seancorfield 2025-09-14T22:07:28.361609Z

Ah, OK, that's like what I did with Expectations since it has syntax that is part of expect -- I added dummy macros for all of that. Thanks.

borkdude 2025-09-14T22:08:53.008459Z

I wonder if we could convince tools.deps to support org transitions since clojars doesn't support them yet. Like, convince tools.deps that it should treat slingshot/slingshot and org.clj-commons/slingshot as the same library so it can compare versions, and you don't end up with two libs on the same classpath if transitive libs still depend on the older one

borkdude 2025-09-14T22:11:13.604229Z

something like:

{:deps {slingshot/slingshot {:mvn/version "2.0.0" :mvn/lib org.clj-commons/slingshot}}}
it wouldn't be too weird, since you can do the same trick with git libs and forks

borkdude 2025-09-14T22:12:09.638189Z

afk now

2025-09-14T22:19:19.562509Z

if we don't have access to stephen's clojars account, we should probably migrate the namespaces as well, right? treat it as a whole new library?

borkdude 2025-09-14T22:22:10.612819Z

That might also be a solution . I donโ€™t think this has been consistently done in the past though

๐Ÿ‘ 1
seancorfield 2025-09-15T00:33:00.679719Z

With durable-queue, I put out a version with the original single-segment ns but the upcoming 0.2.0 has clj-commons.durable-queue which I should have done first. I don't know how widely-used it is and I just forgot that when I put out 0.1.7 ๐Ÿ˜ž For slingshot, I'll make sure to switch to clj-commons.slingshot (from slingshot.slingshot) straight away! Learned my lesson ๐Ÿ™‚

lread 2025-09-15T01:26:12.879219Z

I think it has been a mixed bag, for example, clj-yaml got new maven coords but kept its old namespaces. But moving forward, makes sense to change namespaces when we can't preserve maven coords.

lread 2025-09-15T01:27:42.860309Z

@borkdude, could a tool like unused-deps check if resolved deps have overlapping namespaces?

dgr 2025-09-15T01:29:14.202109Z

There are also some projects using org.clj-commons/<project>. For example, org.clj-comons/byte-streams. It would probably be good to decide on org.clj-commons/... vs clj-commons/โ€ฆ.

lread 2025-09-15T01:33:44.922589Z

I think maybe that has more to do with clojars verified group names?

๐Ÿ‘ 2
lread 2025-09-15T01:34:35.760919Z

New coords have to use the verified org.clj-commons I think.

lread 2025-09-15T01:35:13.270229Z

Older projects under clj-commons are grandfathered.

seancorfield 2025-09-15T01:35:25.257239Z

The group is org.clj-commons. The ns root is often clj-commons.

๐Ÿ‘ 2
seancorfield 2025-09-15T01:35:52.441839Z

Several of Zach's libs have moved (incl. durable-queue) and have that transformation.

dgr 2025-09-15T01:36:09.840349Z

Right

lread 2025-09-14T00:34:06.893029Z

Sad that Stephen Gilardi is no longer with us. Are you volunteering to maintain slingshot @droberts3, or just proposing that it happen? I don't think it would be a huge effort to maintain. Could add it to my list.

dgr 2025-09-14T00:39:21.022609Z

I was not volunteering but merely proposing. ๐Ÿ˜€

๐Ÿ‘ 1
seancorfield 2025-09-14T01:40:27.664379Z

I'd actually be interested in maintaining it... I've been curious about it for a while and, after all, I ended up maintaining another of his libraries: clojure.contrib.sql aka clojure.java.jdbc

lread 2025-09-14T01:54:27.229489Z

Coolio! If you need a hand @seancorfield, lemme know. I suppose we'd need to use new Maven coordinates.

seancorfield 2025-09-14T01:56:53.459439Z

Yes, it would have to be org.clj-commons/slingshot I'll ping Kevin as well because he's been involved with Slingshot in the past...

seancorfield 2025-09-14T01:59:02.704359Z

https://github.com/alexandergunnarson/slingshot seems to have added cljs support so I'll ping them too.