Repository navigation
Fix stale aliases and refers after a reload - #83
Merged
Merged
Conversation
bbatsov
force-pushed
the
repair-aliases-after-reload
branch
from
November 6, 2026 09:18
779e2e6 to
2e1772a
Compare
cider-nrepl's refresh and clj-reload both reload a namespace by removing it and loading it again as a new object. The namespaces they don't reload, like the REPL's user, keep their aliases and refers on the old one, so a function added to the file since doesn't resolve through the alias, and requiring the namespace again with the same alias fails with "Alias o already exists". clj-reload's README calls this out. After a reload that reloaded something, neorepl now goes over every namespace and points those aliases and refers at the namespace that has the name now, and its var by the same name. Anything without a replacement stays as it was, which keeps :as-alias keywords working and doesn't throw away what another client's reload is about to bring back. The check goes by the var's own namespace and name rather than its metadata, since potemkin's import-vars copies another var's :ns and :name. Both reloads are Clojure only, so the code is too.
bbatsov
force-pushed
the
repair-aliases-after-reload
branch
from
November 6, 2026 13:44
2e1772a to
9cf7ecc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
After
,autoreload,eval --reloadorreload, the REPL's aliases and refers stayed on the namespaces the reload replaced, so a function added since didn't resolve through them, and requiring with the same alias again failed. cider-nrepl's reload middleware would be a better home, covering every client, but 0.64.0 doesn't do it.