Support renaming with :as
in import-vars
#77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for renaming symbols when using
import-vars
:This is another attempt at making progress on the now 8 year old #47. #9 added this feature to
import-fn
,import-macro
, andimport-def
, but not toimport-vars
(i.e. #46, which states that this was implemented also forimport-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".