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.
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
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.
Yeah, that's why it's important to change nses right out of the gate with this one!
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.
that's great news. i tried to update the repo to test above 1.8 and it currently fails lol
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"))Changing that test to this passes on 1.8 up to 1.12:
(is (re-find #"stack_trace(_fn)?$" className))would be nice to include the clj-kondo configs as part of this migration @seancorfield , as described in the original post
if you need any help with that, let me know
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 ๐
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 combinatorAh, 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.
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
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 forksafk now
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?
That might also be a solution . I donโt think this has been consistently done in the past though
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 ๐
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.
@borkdude, could a tool like unused-deps check if resolved deps have overlapping namespaces?
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/โฆ.
I think maybe that has more to do with clojars verified group names?
New coords have to use the verified org.clj-commons I think.
Older projects under clj-commons are grandfathered.
The group is org.clj-commons. The ns root is often clj-commons.
Several of Zach's libs have moved (incl. durable-queue) and have that transformation.
Right
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.
I was not volunteering but merely proposing. ๐
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
Coolio! If you need a hand @seancorfield, lemme know. I suppose we'd need to use new Maven coordinates.
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...
https://github.com/alexandergunnarson/slingshot seems to have added cljs support so I'll ping them too.