clj-commons

István Karaszi 2025-03-06T09:29:34.884879Z

Is there any chance that the potemkin library gets some attention or is it abandoned? I am interested in the import-vars aliasing feature, that has two open PRs related to the aliasing feature. https://github.com/clj-commons/potemkin

👍 1
István Karaszi 2025-03-07T09:11:50.883549Z

https://github.com/clj-commons/potemkin/pull/78

✅ 1
István Karaszi 2025-03-07T09:12:23.772709Z

I am recommending to disable whitespaces for the review because the formatter also fixed the indenting: https://github.com/clj-commons/potemkin/pull/78/files?w=1

slipset 2025-03-07T10:36:59.208639Z

I’ll try to get to it over the weekend. Please ping me on Monday if I didn’t?

1
István Karaszi 2025-03-07T11:01:25.455889Z

Sure, thank you!

slipset 2025-03-09T10:16:31.172979Z

I’ve deployed a new version with your PR in it to clojars. 0.4.8 Would you mind taking it for a spin? And if it works, could you write an annoucement in #announcements?

slipset 2025-03-09T10:16:37.605429Z

Thanks a lot for your help @ikaraszi!

🎉 1
István Karaszi 2025-03-09T11:07:20.286259Z

Sure, absolutely! Thank you very much!

2
István Karaszi 2025-03-09T17:46:32.917599Z

The code works, but I’ve just realized that clj-kondo has a special code to handle potemkin’s import-vars, therefore now clj-kondo throws an error for me on the new usage

slipset 2025-03-09T19:13:47.922959Z

PR welcome!

István Karaszi 2025-03-09T19:15:04.710349Z

That should be against clj-kondo, and I am not sure how much time it will take for me

slipset 2025-03-09T21:00:12.019389Z

I was under the impression that you could bundle clj-kondo settings with a lib.

István Karaszi 2025-03-10T07:24:30.429569Z

There are bundled clj-kondo rules but the import-vars macro is explicitly excluded and the definition of that is in clj-kondo. I believe @borkdude knows the reasons behind the decision

borkdude 2025-03-10T08:54:14.684179Z

you changed the syntax of import-vars?

István Karaszi 2025-03-10T08:54:36.900259Z

I added support for renaming, I kept the support for the previous syntax

borkdude 2025-03-10T08:54:40.860429Z

I kinda hoped import-vars would be dead by now ;)

borkdude 2025-03-10T08:54:57.535619Z

but clj-kondo issue welcome, I'll see what I can do ;)

István Karaszi 2025-03-10T08:55:00.645929Z

Huh! How come? What would be the replacement?

borkdude 2025-03-10T08:56:02.163899Z

nothing. take a look at tools.build for example. just write normal clojure

borkdude 2025-03-10T08:56:12.605319Z

anyway, clj-kondo supports import-vars so issue welcome

slipset 2025-03-10T08:57:00.066269Z

Yah, I’m curious to the use case where import-vars is a huge benefit.

István Karaszi 2025-03-10T08:57:34.847449Z

To re-use the metadata, documentation, parameter naming, etc. and re-export a var with all of those

slipset 2025-03-10T08:58:46.351209Z

Yes, I sort of get that, but when is it that you want to do it? I don’t think I’ve ever come across a use for it. I know of one which is here, but the author implemented their own macros https://github.com/expez/superstring/blob/master/src/superstring/core.clj#L42-L43

slipset 2025-03-10T08:59:14.981169Z

Basically, the use-case is to let superstring expose all of clojure.string fns under its own ns.

István Karaszi 2025-03-10T09:00:24.125569Z

Well in our case we want to re-export only just a subset of vars (one or two)

István Karaszi 2025-03-10T09:03:57.384459Z

So for example, there is a db namespace in our application and we are using next.jdbc, and we have a couple of wrapping functions for our convenience for some of the next.jdbc provided functions, like execute! and execute-one!, technically that namespace is the API that our application is using when communicating to the DB layer. We also want to expose other functions like plan (as plan!) but without wrapping.

slipset 2025-03-10T09:07:57.701359Z

Right. I guess I’d just wrap. It’s less magical. YMMV

slipset 2025-03-10T09:10:18.443289Z

From the repo 🙂

István Karaszi 2025-03-10T09:16:32.287969Z

That is what we did, but then the documentation is missing

István Karaszi 2025-03-10T09:17:13.591419Z

But that is why I started my thread asking if this is abandoned or what is the state.

slipset 2025-03-10T09:19:15.604849Z

So most of the libs under clj-commons are in a state of life support, ie fixing bugs and updating deps and such. The reason for this is to avoid a host of forks. Doing some new features like you did, is totally fine, but not to be expected to be driven by clj-commons themselves.

István Karaszi 2025-03-10T09:32:04.116859Z

I’ve added the ticket @borkdude, but TBH I am unsure then we should go this way at all.

István Karaszi 2025-03-06T09:30:07.025899Z

I would like to know whether this is a dead end and we should avoid using it or just fell through the cracks

thenonameguy 2025-03-06T09:31:04.701859Z

Would a PR adding native deps.edn integration be accepted? That would at least allow forks to be used.

👆 1
slipset 2025-03-06T11:44:04.590619Z

Probably fell through the cracks.

slipset 2025-03-06T11:45:19.523799Z

The whole premise of clj-commons is to avoid a proliferation of forks, so it’d be better if we got the PRs through.

👍 2
István Karaszi 2025-03-06T11:48:27.664179Z

Yes, exactly!

slipset 2025-03-06T11:48:34.154659Z

So, there’s two of them which seem to do some of the same things. Could I ask you to do a review of the two and come up with a recommendation of which one (or both)?

István Karaszi 2025-03-06T11:49:29.903509Z

#47 has merge conflicts, but it follows more what has been proposed in #46. #77 is more up to date with a different syntax

István Karaszi 2025-03-06T11:51:47.962459Z

I guess it is more like what you guys imagined as the interface for this library. If you ask me I would rather go with the require like aliasing approach. Something like:

(import-vars
  [clojure.string :refer [starts-with?] :rename {starts-with? begins-with?}])
But this is a third approach 🙂

István Karaszi 2025-03-06T11:53:24.415849Z

Or if we want to make that shorter, then:

(import-vars
 [clojure.string [includes?] {starts-with? begins-with?}])

István Karaszi 2025-03-06T11:54:04.039829Z

But I guess I would prefer the former

István Karaszi 2025-03-06T12:14:40.937979Z

IMO if the require like approach would be used then that would require less work on the toolings

István Karaszi 2025-03-06T12:19:50.609359Z

If you agree, then I guess I can start working on my proposal as the third PR.

slipset 2025-03-06T15:17:43.883409Z

The thing is that this lib is not really actively developed any more, that’s why it’s under clj-commons. I would appreciate a third PR from you.

István Karaszi 2025-03-06T15:18:26.713889Z

Alrighty, then I’ll try to do that tonight

István Karaszi 2025-03-06T15:18:30.214869Z

Thank you!