Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support renaming with :as in import-vars #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

he-la
Copy link

@he-la he-la commented Oct 8, 2024

Add support for renaming symbols when using import-vars:

(import-vars
  [clojure.walk
    [prewalk :as walk-pre]
    postwalk]
  [clojure.data
    diff])

This is another attempt at making progress on the now 8 year old #47. #9 added this feature to import-fn, import-macro, and import-def, but not to import-vars (i.e. #46, which states that this was implemented also for import-vars, was a bit too optimistic in their reading of #9).

I've decided to keep the syntax more aligned with require and left the syntax+implementation open to support other keywords in the future if ever needed.

Since clj-kondo special-cases import-vars, an additional PR will need to be made there - I will do this once this is merged. Importantly, this change does not break any backwards compatibility, and the PR to clj-kondo can be implemented in such a way that it is still compatible with older versions of potemkin too, so these changes don't need to be strictly synchronized.


Renaming symbols in import-vars is probably some form of anti-pattern. Nevertheless I've found it useful to build slightly modified versions of third-party libraries by redefining some of their public exports, and re-exporting the original symbols under a different name as an "escape hatch".

Using this is probably some form of anti-pattern. Nevertheless I've
found it useful to build slightly modified versions of third-party
libraries by redefining some of their public exports, and re-exporting
the original symbols under a different name as an "escape hatch".
@he-la he-la requested a review from slipset as a code owner October 8, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant